Emit `@resolved` from `<suspense>` in SSR
What problem does this feature solve?
<suspense>
emits @resolved
, when an asynchronous component has completely resolved async setup()
. However, the event is only emitted client-side but not during server-side-rendering. Is this expected behavior or considered to be a bug?
I'd like the serialize the cache of my GraphQL-client, after a page was completely rendered on the server, so the client-side GraphQL-client can later pick up the serialized cache during hydration. However, it's difficult to wait for the async setup to be completed. Of course, one could work around the issue by calling the serialization procedure at the end of async setup()
manually, but I would have to repeat this code almost on every rendered page. It would be much nicer to hook into @resolved
.
What does the proposed API look like?
The API looks exactly like now: <suspense @resolved="serializeState()">...</suspense>
. But unlike now, it should work with SSR, too.