adata-ui 2.0.35 → 2.0.37

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.
@@ -86,23 +86,24 @@ function updateState() {
86
86
  isOpen.value = !!state
87
87
  }
88
88
  }
89
+ let observer: MutationObserver | null = null
89
90
 
90
91
  onMounted(() => {
91
- if (accordion.value) {
92
- updateState()
92
+ if (!accordion.value) return
93
93
 
94
- const observer = new MutationObserver(() => {
95
- updateState()
96
- })
94
+ updateState()
97
95
 
98
- observer.observe(accordion.value?.el, {
99
- attributes: true,
100
- attributeFilter: ['data-headlessui-state']
101
- })
96
+ observer = new MutationObserver(updateState)
97
+ observer.observe(accordion.value.el, {
98
+ attributes: true,
99
+ attributeFilter: ['data-headlessui-state']
100
+ })
101
+ })
102
102
 
103
- onBeforeUnmount(() => {
104
- observer.disconnect()
105
- })
103
+ onBeforeUnmount(() => {
104
+ if (observer) {
105
+ observer.disconnect()
106
+ observer = null
106
107
  }
107
108
  })
108
109
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adata-ui",
3
3
  "type": "module",
4
- "version": "2.0.35",
4
+ "version": "2.0.37",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",