fix(island): 🐛 prevent displaying fallback when Suspense is loaded

This commit is contained in:
Julien Oculi 2024-07-02 13:06:56 +02:00
parent f2c8b145e6
commit 72281ae551

View file

@ -27,8 +27,10 @@ export default function Suspense(
},
) {
const displayed = useSignal(loader)
let loaded = false
signal?.addEventListener('abort', () => {
if (loaded) return
try {
signal.throwIfAborted()
} catch (error) {
@ -40,6 +42,7 @@ export default function Suspense(
.then((element) => {
if (signal?.aborted) return
displayed.value = element
loaded = true
})
.catch((error) => {
if (signal?.aborted) return