Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding visible state to Suspense Fallback component to enhance CSS transitions. #17296

Closed
jimmy-e opened this issue Nov 7, 2019 · 7 comments
Closed

Comments

@jimmy-e
Copy link

jimmy-e commented Nov 7, 2019

Do you want to request a feature or report a bug?
Feature I suppose.

What is the current behavior?
Suspense fallback component flashes on and immediately unmounts (flashes off) when fetching is complete. See similar discussions here and here.

What is the expected behavior?
It would be ideal to add better transitions to the fallback component when it mounts and unmounts, but doing so requires using something like TransitionGroup or Framer Motion, which require a prop to listen to know when to mount and unmount. If we could somehow have the fallback component receive some kind of state from Suspense on when it is mounting and unmounting the fallback component, that would be great.

@yanickrochon
Copy link

You might be interested with the new useTransition that will most likely make it as an official React hooks. Personally, I have implemented my own meanwhile, and will refactor later.

@jimmy-e
Copy link
Author

jimmy-e commented Dec 3, 2019

Thanks @yanickrochon but the useTransition hook doesn't seem to be able to have Suspense communicate to the fallback when the fallback is getting mounted and unmounted, unless I am missing something?

@stale
Copy link

stale bot commented Mar 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Mar 2, 2020
@stale
Copy link

stale bot commented Mar 9, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@stale stale bot closed this as completed Mar 9, 2020
@gaearon gaearon reopened this Apr 1, 2020
@stale stale bot removed the Resolution: Stale Automatically closed due to inactivity label Apr 1, 2020
@gaearon
Copy link
Collaborator

gaearon commented Apr 1, 2020

This is something we're interested in. Want to write an RFC? https:/reactjs/rfcs

@jimmy-e
Copy link
Author

jimmy-e commented Apr 1, 2020

@gaearon on it, will try to take write up this weekend.

@jimmy-e
Copy link
Author

jimmy-e commented Apr 13, 2020

@gaearon , RFC has been written here, thanks!

@jimmy-e jimmy-e closed this as completed Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants