spin-delay icon indicating copy to clipboard operation
spin-delay copied to clipboard

Support SSR mode

Open phongphongg opened this issue 2 years ago • 2 comments

Description

In SSR mode, useSpinDelay always returns false even though loading = true because useEffect is not executed in SSR mode.

Solution

Return the value of the loading variable in SSR mode.

phongphongg avatar Sep 03 '23 08:09 phongphongg

@smeijer, could you please help review this PR?

phongphongg avatar Sep 17 '23 14:09 phongphongg

Hi! Thanks for the PR. I appreciate it, and acknowledge the issue. I haven't tried it, but purely based from the code I see I believe this can result into a spinner flash. The one thing this lib tries to prevent.

If the server now passes a loading = true, a spinner is shown. When the client sets it to false, the spinner directly dissappears. Even if the flip happens in a fraction of a second.

Can you confirm that?

smeijer avatar Oct 01 '23 18:10 smeijer

Hi, I've given this branch a test run, and indeed found the expected issues. This spinner flickers on the initial render. I've changed the approach in #8 . Thank you so much for the idea and your contribution.

smeijer avatar Mar 13 '24 20:03 smeijer