@awes-io/ui 2.145.0 → 2.145.2

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
@@ -3,6 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.145.2](https://github.com/awes-io/client/compare/@awes-io/ui@2.145.1...@awes-io/ui@2.145.2) (2026-09-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * unused dependency removed ([225dd49](https://github.com/awes-io/client/commit/225dd490d0dda8226ff89ef71d6494b3ca951f62))
12
+ * **ui:** fire beforeDestroy teardown, guard AwPageSingle slots and refs ([4a0cca1](https://github.com/awes-io/client/commit/4a0cca1a456e061ddbcc5511b9ff958737dc9555))
13
+
14
+
15
+
16
+
17
+
18
+ ## [2.145.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.145.0...@awes-io/ui@2.145.1) (2026-08-21)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **ui:** destroy google maps instances on component teardown ([585a6e8](https://github.com/awes-io/client/commit/585a6e85a38b29e59d8ee518791e736e12b6522c))
24
+
25
+
26
+
27
+
28
+
6
29
  # 2.145.0 (2026-08-10)
7
30
 
8
31
 
@@ -76,6 +76,8 @@ export default {
76
76
  return
77
77
  }
78
78
 
79
+ if (!this.placesService) return
80
+
79
81
  this.placesService.getDetails(
80
82
  {
81
83
  placeId: place.place_id,
@@ -100,19 +102,22 @@ export default {
100
102
  this.$nextTick(this.init)
101
103
  },
102
104
 
105
+ beforeDestroy() {
106
+ this.destroyServices()
107
+ },
108
+
103
109
  methods: {
104
110
  async init() {
105
111
  if (!this.isGmInited()) {
106
112
  await this.gmInit()
107
113
  }
108
114
 
115
+ if (this.gmDestroyed || !this.$refs.place) {
116
+ return
117
+ }
118
+
109
119
  if (!window.google) {
110
- if (this.attempt < this.maxLoadScripAttempts) {
111
- setTimeout(this.init, 200)
112
- this.attempt++
113
- } else {
114
- console.error('Cannot load Google script')
115
- }
120
+ this.gmRetryInit(this.init)
116
121
  return
117
122
  }
118
123
 
@@ -122,6 +127,14 @@ export default {
122
127
  )
123
128
  },
124
129
 
130
+ destroyServices() {
131
+ this.gmClearInstance(this.autocomplete)
132
+ this.gmClearInstance(this.placesService)
133
+ this.autocomplete = null
134
+ this.placesService = null
135
+ this.sessionToken = null
136
+ },
137
+
125
138
  search(text) {
126
139
  if (!this.autocomplete) return
127
140
 
@@ -151,6 +164,8 @@ export default {
151
164
  },
152
165
 
153
166
  _setSuggestions(data) {
167
+ if (!this.$refs.select) return
168
+
154
169
  this.$refs.select.isLoading = false
155
170
  this.suggestions = data || []
156
171
  },
@@ -76,6 +76,10 @@ export default {
76
76
  this.$nextTick(this.init)
77
77
  },
78
78
 
79
+ beforeDestroy() {
80
+ this.destroyMap()
81
+ },
82
+
79
83
  watch: {
80
84
  options(val) {
81
85
  if (val && this.map) {
@@ -90,13 +94,12 @@ export default {
90
94
  await this.gmInit()
91
95
  }
92
96
 
97
+ if (this.gmDestroyed || !this.$refs.map) {
98
+ return
99
+ }
100
+
93
101
  if (!window.google) {
94
- if (this.attempt < this.maxLoadScripAttempts) {
95
- setTimeout(this.init, 200)
96
- this.attempt++
97
- } else {
98
- console.error('Cannot load Google script')
99
- }
102
+ this.gmRetryInit(this.init)
100
103
  return
101
104
  }
102
105
 
@@ -115,6 +118,12 @@ export default {
115
118
  this.$emit(eventName, event)
116
119
  })
117
120
  })
121
+ },
122
+
123
+ destroyMap() {
124
+ this.gmClearInstance(this.map)
125
+ this.gmClearInstance(this.$refs.map)
126
+ this.map = null
118
127
  }
119
128
  }
120
129
  }
@@ -3,6 +3,8 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
+ import { pathOr } from 'rambdax'
7
+
6
8
  const events = [
7
9
  'click',
8
10
  'rightclick',
@@ -48,8 +50,16 @@ export default {
48
50
  this.$nextTick(this.init)
49
51
  },
50
52
 
53
+ beforeDestroy() {
54
+ this.destroyMarker()
55
+ },
56
+
51
57
  methods: {
52
58
  init() {
59
+ if (this._isDestroyed || !window.google || !this.google.map) {
60
+ return
61
+ }
62
+
53
63
  this.marker = new window.google.maps.Marker({
54
64
  map: this.google.map,
55
65
  ...this.options
@@ -63,6 +73,19 @@ export default {
63
73
  this.$emit(eventName, event)
64
74
  })
65
75
  })
76
+ },
77
+
78
+ destroyMarker() {
79
+ if (!this.marker) return
80
+
81
+ const event = pathOr(null, 'google.maps.event', window)
82
+
83
+ if (event) {
84
+ event.clearInstanceListeners(this.marker)
85
+ }
86
+
87
+ this.marker.setMap(null)
88
+ this.marker = null
66
89
  }
67
90
  }
68
91
  }
@@ -171,7 +171,6 @@
171
171
  import { pathOr } from 'rambdax'
172
172
  import pageMixin from '@AwMixins/page'
173
173
  import AwBottomBar from '@AwOrganisms/AwBottomBar.vue'
174
- import { conf } from '@AwUtils/component'
175
174
 
176
175
  export default {
177
176
  name: 'AwPage',
@@ -316,7 +315,7 @@ export default {
316
315
  }
317
316
  },
318
317
 
319
- beforeDestory() {
318
+ beforeDestroy() {
320
319
  this.$emit('update:fullscreen', false)
321
320
  this.watchFullscreenState(false)
322
321
  document.body.style.removeProperty('--page-buttons-bottom')
@@ -202,7 +202,10 @@ export default {
202
202
  },
203
203
 
204
204
  hasPreview() {
205
- return this.$scopedSlots.preview || this.$slots.preview
205
+ return (
206
+ pathOr(null, 'preview', this.$scopedSlots) ||
207
+ pathOr(null, 'preview', this.$slots)
208
+ )
206
209
  },
207
210
 
208
211
  isDesktopActionBeforeMenu() {
@@ -224,6 +227,8 @@ export default {
224
227
 
225
228
  const { topScrollMark, bottomScrollMark } = this.$refs
226
229
 
230
+ if (!topScrollMark || !bottomScrollMark) return
231
+
227
232
  this.$options.$observer = new IntersectionObserver((entries) => {
228
233
  for (let i = 0; i < entries.length; i++) {
229
234
  const entry = entries[i]
@@ -1,5 +1,14 @@
1
1
  import loadjs from 'loadjs'
2
- import { filter, isEmpty, toPairs, join, map, not, compose } from 'rambdax'
2
+ import {
3
+ filter,
4
+ isEmpty,
5
+ toPairs,
6
+ join,
7
+ map,
8
+ not,
9
+ compose,
10
+ pathOr
11
+ } from 'rambdax'
3
12
 
4
13
  const GOOGLE_MAPS_ID = 'google-maps'
5
14
 
@@ -55,6 +64,16 @@ export default {
55
64
  }
56
65
  },
57
66
 
67
+ created() {
68
+ this.gmDestroyed = false
69
+ this.gmInitTimer = null
70
+ },
71
+
72
+ beforeDestroy() {
73
+ this.gmDestroyed = true
74
+ this.gmClearInitTimer()
75
+ },
76
+
58
77
  methods: {
59
78
  gmInit() {
60
79
  return loadjs([this.gmLibUrl], GOOGLE_MAPS_ID, {
@@ -64,6 +83,33 @@ export default {
64
83
 
65
84
  isGmInited() {
66
85
  return loadjs.isDefined(GOOGLE_MAPS_ID)
86
+ },
87
+
88
+ gmRetryInit(handler) {
89
+ this.gmClearInitTimer()
90
+
91
+ if (this.attempt >= this.maxLoadScripAttempts) {
92
+ console.error('Cannot load Google script')
93
+ return
94
+ }
95
+
96
+ this.attempt++
97
+ this.gmInitTimer = setTimeout(handler, 200)
98
+ },
99
+
100
+ gmClearInitTimer() {
101
+ if (this.gmInitTimer) {
102
+ clearTimeout(this.gmInitTimer)
103
+ this.gmInitTimer = null
104
+ }
105
+ },
106
+
107
+ gmClearInstance(instance) {
108
+ const event = pathOr(null, 'google.maps.event', window)
109
+
110
+ if (instance && event) {
111
+ event.clearInstanceListeners(instance)
112
+ }
67
113
  }
68
114
  }
69
115
  }
package/mixins/page.js CHANGED
@@ -81,7 +81,7 @@ export default {
81
81
  this._initScrollWatcher()
82
82
  },
83
83
 
84
- beforeDestory() {
84
+ beforeDestroy() {
85
85
  this._disableScrollWatcher()
86
86
  },
87
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awes-io/ui",
3
- "version": "2.145.0",
3
+ "version": "2.145.2",
4
4
  "description": "User Interface (UI) components",
5
5
  "keywords": [
6
6
  "ui",
@@ -116,5 +116,5 @@
116
116
  "peerDependencies": {
117
117
  "nuxt": "^2.18.1"
118
118
  },
119
- "gitHead": "a1636efce4ca722c009daa3eb5ffeb92e908bf53"
119
+ "gitHead": "2ca960492ca09b5dfd6cb0d530bafd4afb968dba"
120
120
  }