SolidJSS
SolidJS14mo ago
3 replies
sean

Optimistically change URL and state without waiting for async to resolve

I have a list of <A/> in the sidebar.

The pages that those <A/> link to have an async data using createAsync. The whole page component is wrapped in a Suspense boundary with a spinner fallback.

Current behavior: when clicking a link, the URL and the state (in this case, the activeClass prop in the <A/>) stays the same until the whole request or the async data is resolved. While navigating, the page component displays the fallback spinner as it should, not the URL and and the <A/> state doesn't update.

Ideal situation: URL changes and and page state is updated instantaneously without waiting for the request to resolve.

Is there a way that the URL and state are automatically changed while navigating?
Was this page helpful?