rails_modal_manager 1.0.44 → 1.0.45
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35bbae9104923aaa6bc1fa87eacd8616c2ef0aaf538ed1210fb369c3f25e89e2
|
|
4
|
+
data.tar.gz: 34ba022c5adac89ff47c3f505215acef624056da6f48afaec02bc42e611e587e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f94273a89dcd52dba439b464196f7c3db208a28405c01f582227e81bb3c709f236074d6a5bca7c6dcdbf53dcf822357d47da9ae643aa23463f25a5d000b55d35
|
|
7
|
+
data.tar.gz: 2c8f6ffd4bfced2dcf0ae66a5f8b0f39b63d58fa490f5bbdc7e114f3cbd88810d6c73c054a435e5a3a041d5e3adc7ff67f4e323305f45ed3bb367b2e9748a278
|
|
@@ -297,6 +297,15 @@ export default class extends Controller {
|
|
|
297
297
|
const modal = this.element.closest('.rmm-modal')
|
|
298
298
|
if (!modal) return
|
|
299
299
|
|
|
300
|
+
// Abort all pending AJAX requests from all submenu controllers
|
|
301
|
+
modal.querySelectorAll('[data-controller*="rmm-submenu"]').forEach(el => {
|
|
302
|
+
const ctrl = this.application.getControllerForElementAndIdentifier(el, 'rmm-submenu')
|
|
303
|
+
if (ctrl && ctrl.currentAbortController) {
|
|
304
|
+
ctrl.currentAbortController.abort()
|
|
305
|
+
ctrl.currentAbortController = null
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
|
|
300
309
|
// Hide all submenu groups
|
|
301
310
|
modal.querySelectorAll('.rmm-submenu-group').forEach(group => {
|
|
302
311
|
group.classList.remove('rmm-submenu-group-active')
|
|
@@ -45,7 +45,6 @@ export default class extends Controller {
|
|
|
45
45
|
this.ajaxCache = new Map()
|
|
46
46
|
this.currentItemId = null
|
|
47
47
|
this.currentAbortController = null
|
|
48
|
-
this.currentRequestId = 0
|
|
49
48
|
|
|
50
49
|
// Find initial active item
|
|
51
50
|
const activeItem = this.element.querySelector('.rmm-submenu-item.rmm-active')
|
|
@@ -165,14 +164,18 @@ export default class extends Controller {
|
|
|
165
164
|
return
|
|
166
165
|
}
|
|
167
166
|
|
|
168
|
-
// Abort previous pending request
|
|
167
|
+
// Abort previous pending request from this controller
|
|
169
168
|
if (this.currentAbortController) {
|
|
170
169
|
this.currentAbortController.abort()
|
|
171
170
|
}
|
|
172
171
|
|
|
173
172
|
const abortController = new AbortController()
|
|
174
173
|
this.currentAbortController = abortController
|
|
175
|
-
|
|
174
|
+
|
|
175
|
+
// Global request counter on the shared content container
|
|
176
|
+
// This ensures cross-controller coordination (e.g., when switching sidebar groups)
|
|
177
|
+
const requestId = (parseInt(contentContainer.dataset.rmmRequestId || '0', 10) + 1)
|
|
178
|
+
contentContainer.dataset.rmmRequestId = requestId
|
|
176
179
|
|
|
177
180
|
// Show loading state
|
|
178
181
|
contentContainer.classList.add('rmm-tab-loading')
|
|
@@ -194,7 +197,8 @@ export default class extends Controller {
|
|
|
194
197
|
const html = await response.text()
|
|
195
198
|
|
|
196
199
|
// Validate: only update if this is still the latest request
|
|
197
|
-
|
|
200
|
+
// Uses the shared counter on the DOM element, not instance-level counter
|
|
201
|
+
if (parseInt(contentContainer.dataset.rmmRequestId, 10) !== requestId) {
|
|
198
202
|
return
|
|
199
203
|
}
|
|
200
204
|
|