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

bug - flash interaction with navigate #1701

Closed
wminshew opened this issue Jan 30, 2021 · 9 comments · Fixed by #2609
Closed

bug - flash interaction with navigate #1701

wminshew opened this issue Jan 30, 2021 · 9 comments · Fixed by #2609

Comments

@wminshew
Copy link
Contributor

A very common pattern with creation & deletion mutations is to simultaneously navigate upon completion. I have noticed that the flash messages don't seem to interact well with the navigation--the flash appears & almost immediately disappears after the navigation.

    onCompleted: ({ createAsk: { title } }) => {
      navigate(routes.asks({ companyId }))
      addMessage(`Ask created: ${title}`, { classes: 'rw-flash-success' })
    },

is there another a way around this that I'm missing? not able to await etc afaik on the navigate call. Or do most of you either navigate OR add a flash message for your CRUD interactions?

@jvanbaarsen
Copy link
Contributor

@wminshew What happens if you switch the two lines around? Or doesn't that make any difference?

@wminshew
Copy link
Contributor Author

wminshew commented Feb 1, 2021

confirmed - no difference

@peterp
Copy link
Contributor

peterp commented Feb 1, 2021

@cannikin I don't think I've seen this particular behaviour myself, is this something that you've noticed before?

@cannikin
Copy link
Member

cannikin commented Feb 1, 2021

I've noticed that if you don't wait for a flash message to disappear before invoking a second one, it sort of "resets" the timer and now you'll see two messages, then three, then four...until you finally let them disappear, then they'll be gone for good.

@peterp
Copy link
Contributor

peterp commented Feb 1, 2021

@cannikin Maybe we should abstract something like https://react-hot-toast.com/ instead of having our own?

@peterp
Copy link
Contributor

peterp commented Feb 1, 2021

I mean... we could keep the interface, but just use them under the hood. RHT is currently smaller than our implementation.

@cannikin
Copy link
Member

cannikin commented Feb 1, 2021

hahaha I do love that name.

Yeah, it'd be nice to not have to worry about debugging a custom implementation when someone else has (hopefully) figured all that out already. Looks like they have some interesting options for styling and such, too.

@dthyresson
Copy link
Contributor

Looks like they have some interesting options for styling and such, too.

I'd be curious if it plays well with TailwindCSS/UI such that

https://tailwindui.com/components/application-ui/feedback/alerts

their Alerts like

image

could be styled that way.

If so, yes toast please!

@jtoar
Copy link
Contributor

jtoar commented May 18, 2021

This has definitely been ameliorated by react hot toast, but using Sets in scaffolds would seal the deal on getting rid of this awkward rerendering: #2546.

@jtoar jtoar linked a pull request May 25, 2021 that will close this issue
14 tasks
@jtoar jtoar added this to the next-release-candidate milestone May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants