@awes-io/ui 2.145.0 → 2.145.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
|
@@ -3,6 +3,17 @@
|
|
|
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.1](https://github.com/awes-io/client/compare/@awes-io/ui@2.145.0...@awes-io/ui@2.145.1) (2026-08-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui:** destroy google maps instances on component teardown ([585a6e8](https://github.com/awes-io/client/commit/585a6e85a38b29e59d8ee518791e736e12b6522c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# 2.145.0 (2026-08-10)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
}
|
package/mixins/google-maps.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import loadjs from 'loadjs'
|
|
2
|
-
import {
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awes-io/ui",
|
|
3
|
-
"version": "2.145.
|
|
3
|
+
"version": "2.145.1",
|
|
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": "
|
|
119
|
+
"gitHead": "b0e0122306c0ef4a6c716f6afc0d83f774b29b0e"
|
|
120
120
|
}
|