@csedl/svelte-on-rails 11.0.3 → 11.0.4
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/package.json
CHANGED
|
@@ -11,8 +11,10 @@ export function cleanupSvelteComponent(element) {
|
|
|
11
11
|
try {
|
|
12
12
|
const instance = svelteInstances.get(element);
|
|
13
13
|
if (instance) {
|
|
14
|
-
unmount(instance)
|
|
15
|
-
|
|
14
|
+
unmount(instance).then(()=>{
|
|
15
|
+
debugLog(`Successfully unmounted Svelte component for element:`, element);
|
|
16
|
+
}); // Destroy the Svelte component instance in Svelte 5
|
|
17
|
+
debugLog(`Unmounted Svelte component for element:`, element);
|
|
16
18
|
element.removeAttribute('data-svelte-initialized'); // Reset initialized state
|
|
17
19
|
svelteInstances.delete(element); // Remove from WeakMap
|
|
18
20
|
} else {
|
|
@@ -5,6 +5,9 @@ import {cleanupSvelteComponent} from "./cleanupSvelteComponent.js";
|
|
|
5
5
|
export default class extends Controller {
|
|
6
6
|
|
|
7
7
|
connect() {
|
|
8
|
+
|
|
9
|
+
console.log('SVELTE CONNECT')
|
|
10
|
+
|
|
8
11
|
const stat = this.element.getAttribute('data-svelte-status');
|
|
9
12
|
if (stat === 'do-not-hydrate-build-me') return;
|
|
10
13
|
|