swr icon indicating copy to clipboard operation
swr copied to clipboard

fix(loading): Prevent isLoading from being true with fallbackData

Open Conqxeror opened this issue 5 months ago • 2 comments

This PR addresses an issue where isLoading was incorrectly set to true even when fallbackData was provided, particularly in SSR scenarios. This led to a "flash of skeleton" UI, which is undesirable when initial data is already available.

The change modifies the logic to ensure that isLoading remains false when fallbackData is present, while isValidating correctly reflects the background revalidation process. This allows the initial server-cached data to be displayed immediately, providing a smoother user experience.

Fixes #3046

Conqxeror avatar Jun 28 '25 23:06 Conqxeror

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

codesandbox-ci[bot] avatar Jun 28 '25 23:06 codesandbox-ci[bot]

Would love to have a test case for this, thanks!

shuding avatar Jul 19 '25 19:07 shuding