@gitlab/ui 59.3.0 → 59.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [59.3.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v59.3.0...v59.3.1) (2023-04-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **base_dropdown:** conditional chaining to destroy popper ([05cf79e](https://gitlab.com/gitlab-org/gitlab-ui/commit/05cf79e0fdaf55d9403fcdaba062d416294b3815))
7
+
1
8
  # [59.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v59.2.0...v59.3.0) (2023-04-04)
2
9
 
3
10
 
@@ -200,7 +200,8 @@ var script = {
200
200
  this.checkToggleFocusable();
201
201
  },
202
202
  beforeDestroy() {
203
- this.popper.destroy();
203
+ var _this$popper;
204
+ (_this$popper = this.popper) === null || _this$popper === void 0 ? void 0 : _this$popper.destroy();
204
205
  },
205
206
  methods: {
206
207
  checkToggleFocusable() {
@@ -212,7 +213,7 @@ var script = {
212
213
  async toggle() {
213
214
  this.visible = !this.visible;
214
215
  if (this.visible) {
215
- var _this$popper;
216
+ var _this$popper2;
216
217
  /* Initially dropdown is hidden with `display="none"`.
217
218
  When `visible` prop is toggled ON, with the `nextTick` we wait for the DOM update -
218
219
  dropdown's `display="block"` is set (adding CSS class `show`).
@@ -224,7 +225,7 @@ var script = {
224
225
  e.g. set focus.
225
226
  */
226
227
  await this.$nextTick();
227
- await ((_this$popper = this.popper) === null || _this$popper === void 0 ? void 0 : _this$popper.update());
228
+ await ((_this$popper2 = this.popper) === null || _this$popper2 === void 0 ? void 0 : _this$popper2.update());
228
229
  this.$emit(GL_DROPDOWN_SHOWN);
229
230
  } else {
230
231
  this.$emit(GL_DROPDOWN_HIDDEN);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "59.3.0",
3
+ "version": "59.3.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -92,6 +92,13 @@ describe('base dropdown', () => {
92
92
  wrapper.destroy();
93
93
  expect(destroyPopper).toHaveBeenCalled();
94
94
  });
95
+
96
+ it('should not destroy popper instance when component is not initiated', async () => {
97
+ buildWrapper();
98
+ wrapper.destroy();
99
+ await nextTick();
100
+ expect(destroyPopper).not.toHaveBeenCalled();
101
+ });
95
102
  });
96
103
 
97
104
  describe('renders content to the default slot', () => {
@@ -214,7 +214,7 @@ export default {
214
214
  this.checkToggleFocusable();
215
215
  },
216
216
  beforeDestroy() {
217
- this.popper.destroy();
217
+ this.popper?.destroy();
218
218
  },
219
219
  methods: {
220
220
  checkToggleFocusable() {