Skip to content

Commit c920951

Browse files
committed
fix #43: Remove the pull req #39
1 parent 0996be9 commit c920951

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

src/lib/edra/headless/components/SlashCommandList.svelte

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script lang="ts">
2-
import { onDestroy } from 'svelte';
32
import { icons } from 'lucide-svelte';
43
54
interface Props {
@@ -89,8 +88,6 @@
8988
}
9089
return false;
9190
}
92-
93-
onDestroy(() => props.markDestroyed());
9491
</script>
9592

9693
<svelte:window onkeydown={handleKeyDown} />

src/lib/edra/shadcn/components/SlashCommandList.svelte

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script lang="ts">
2-
import { onDestroy } from 'svelte';
32
import { Button } from '$lib/components/ui/button/index.js';
43
import { cn } from '$lib/utils.js';
54
import { icons } from 'lucide-svelte';
@@ -91,8 +90,6 @@
9190
}
9291
return false;
9392
}
94-
95-
onDestroy(() => props.markDestroyed());
9693
</script>
9794

9895
<svelte:window onkeydown={handleKeyDown} />

src/lib/edra/svelte-renderer.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class SvelteRenderer<R = unknown, P extends Record<string, any> = object> {
1818
ref: R | null = null;
1919
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2020
mnt: Record<any, any> | null = null;
21-
isDestroyed = false; // track if the component was already destroyed
2221

2322
constructor(component: App, { props, editor }: RendererOptions<P>) {
2423
this.id = Math.floor(Math.random() * 0xffffffff).toString();
@@ -45,10 +44,7 @@ class SvelteRenderer<R = unknown, P extends Record<string, any> = object> {
4544
this.mnt = mount(this.component as any, {
4645
target: this.element,
4746
props: {
48-
props: {
49-
...this.props,
50-
markDestroyed: () => (this.isDestroyed = true) // to be called on onDestroy in the component
51-
}
47+
props: this.props
5248
}
5349
});
5450
}
@@ -68,10 +64,6 @@ class SvelteRenderer<R = unknown, P extends Record<string, any> = object> {
6864
}
6965

7066
destroy(): void {
71-
if (this.isDestroyed) {
72-
return;
73-
}
74-
7567
if (this.mnt) {
7668
unmount(this.mnt);
7769
} else {

0 commit comments

Comments
 (0)