Closed SapphicMoe closed 9 months ago
I also noticed that users who have JS disabled still see the loading part, even with <noscript>
present.
<section class="flex flex-col pt-5" aria-label="status">
<Suspense>
<Status />
<div slot="fallback">
<noscript>Text that people should see if JS is disabled</noscript>
<p>Text that people should see if JS is enabled but content isn't loaded yet</p>
</div>
</Suspense>
</section>
Is there a way to display *only* the noscript bit to users who have JS disabled? Thanks!
Hello, this works on me.
I dont use the ResolveSuspended in the Layaout I use in the page when I have to use it, and where I do the request in other component, like this in your example:
Thanks for sharing @solelychloe and @gitjoshu! I have a feeling this is an issue when calling ResolveSuspended
from a layout per the above stackblitz. We'll need to investigate if this can be fixed, or if there's a more fundamental limitation.
Thank you @bholmesdev that would be incredible. I really appreciate the work on this stack and I have one question, will simple-stack-stream be compatible with Viewtransitions? As far as I know, if I reload the page or I force navigation with data-astro-reload its works, but I don't know if there is currently a way to not force navigation for simple-stack-stream to function correctly or if you are going to work on it in the future. Thank you very much again.
Alright, I've given this some investigation, and I don't have a fix yet.
Here's what I found:
Suspense
and ResolveSuspended
are used in the same Astro componentSuspense
components will render after ResolveSuspended
. I was hopeful rendering <slot /><ResolveSuspended />
would ensure all slot
contents are streamed first, but it seems slot contents get deferred :(ResolveSuspended
comes at the end. However, this results in a double-render for all layout children. I have a feeling this is prohibitive for most people.I'll work with the Astro core team to see what is possible. For now, I'd only use simple-stack-stream
for the simplest of use cases!
Update: we found a solution! We know render suspended content using middleware. This ensures components render at the right time, and removes the need for ResolveSuspended
🥳
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I'm trying to fetch data from a server:
components/home/Status.astro
:layouts/Page.astro
:View
```astro --- import Head from '@components/base/Head.astro'; import NavBar from '@components/base/NavBar.astro'; import '@fontsource/atkinson-hyperlegible/400.css'; import { slide } from 'astro:transitions'; import Footer from '@components/base/Footer.astro'; import { ResolveSuspended } from 'simple-stack-stream/components'; interface Props { description?: string; pageTitle: string; title?: string; created?: string; ogImage?: { src?: string; alt?: string; }; } const { description = 'Software engineer, sysadmin, community manager.', pageTitle, title = 'Chloe Arciniega', created, ogImage, } = Astro.props; ---Here's my layout file. I'm calling
<ResolveSuspended>
here.pages/index.astro
:View
```astro --- export const prerender = false; import Layout from '@layouts/Page.astro'; import Friends from '@components/home/buttons/Friends.astro'; import OtherButtons from '@components/home/buttons/Other.astro'; import Status from '@components/home/Status.astro'; import { Suspense } from 'simple-stack-stream/components'; ---Loading status...
Hello!
I'm Chloe, a software engineer with a fascination for system administration and messing about with pieces of technology. Feel free to look around to get to know me better! ^w^
Friends
Other
And here's the page where I'm calling
<Suspense>
.Result
All I'm getting is the fallback loading text:
What's the expected result?
I expected the following to happen, step-by-step:
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-lhjbyu?file=src%2Fpages%2Findex.astro
Participation