Add Suspense fallback to LingoProviderWrapper
-
wrapped the client provider in Suspense so we don’t flash blank screens while dictionaries load
-
added a default fallback component plus a fallback prop for teams that want custom UI
-
updated tests to cover the fallback path, error boundaries, and custom render cases
-
ran pnpm --filter @lingo.dev/_react test and verified the Vite demo (dictionary loads immediately so fallback flashes only for a beat on localhost)
Hey @verma-divyanshu-git please link the issue this will solve and only raise a PR after being assigned to an issue.
please update base, it is out of date
@verma-divyanshu-git you need to update the title:
Error: No release type found in pull request title " Add Suspense fallback to LingoProviderWrapper". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/
Available types:
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit
And also make sure you're added changeset
I'd like to review this at some point, if that's okay. If I don't review it within 24 hours and you need to merge it, just merge it.
hey, @sumitsaurabh927, @The-Best-Codes , I have made all the changes, sorry for the trouble
One thing I notice: I can't remove the fallback. Setting it to null doesn't work, it continues to use the default one. IMO, the fallback should be null by default, and you can opt-in to using the default fallback or a custom component.
@The-Best-Codes , Sorry, my bad. The ?? operator treats null as a fallback trigger, so passing fallback={null} still shows the default.
Should I change it so the fallback defaults to null (no UI) and users opt-in with <LingoProviderFallback /> if they want the loading message?
@verma-divyanshu-git Yes, I think that would be best.
@The-Best-Codes , Done! Fallback now defaults to null (no UI). Users opt-in with fallback={<LingoProviderFallback />} if they want the loading message. Just pushed the fix.