fix(island): 🐛 prevent displaying fallback when Suspense
is loaded
This commit is contained in:
parent
f2c8b145e6
commit
72281ae551
|
@ -27,8 +27,10 @@ export default function Suspense(
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const displayed = useSignal(loader)
|
const displayed = useSignal(loader)
|
||||||
|
let loaded = false
|
||||||
|
|
||||||
signal?.addEventListener('abort', () => {
|
signal?.addEventListener('abort', () => {
|
||||||
|
if (loaded) return
|
||||||
try {
|
try {
|
||||||
signal.throwIfAborted()
|
signal.throwIfAborted()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -40,6 +42,7 @@ export default function Suspense(
|
||||||
.then((element) => {
|
.then((element) => {
|
||||||
if (signal?.aborted) return
|
if (signal?.aborted) return
|
||||||
displayed.value = element
|
displayed.value = element
|
||||||
|
loaded = true
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (signal?.aborted) return
|
if (signal?.aborted) return
|
||||||
|
|
Loading…
Reference in a new issue