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

setToast: Toast is never displayed #814

Open
Throvn opened this issue Feb 1, 2023 · 8 comments
Open

setToast: Toast is never displayed #814

Throvn opened this issue Feb 1, 2023 · 8 comments

Comments

@Throvn
Copy link

Throvn commented Feb 1, 2023

Bug report 🐞

Version & Environment

  • Version of browser: Firefox 109 but also tested in Chrome, Mac
  • Version of geist-ui/core: ^2.3.8

Expected Behaviour

The behavior I expect is that when I execute the following snippet, a toast will show up somewhere on the webpage:

import './App.css';
import { Button, useToasts } from '@geist-ui/core';

function App() {
  const { setToast } = useToasts()

  return (
    <Button onClick={() => setToast({ text: "Hello" })}>
      Hello</Button>
  );
}
export default App;

Actual results (or Errors)

Nothing is happening at all. When I check the inspector, the DOM is never modified. No errors are thrown either. I tried to produce a minimal reproducable example. For me Toasts do not get displayed at all. Not even in a fresh cra project.

@dogdogbrother
Copy link

I also encountered this problem, in nextjs.

@Throvn
Copy link
Author

Throvn commented Feb 3, 2023

After further investigation, I noticed that the updateToasts() inside of use-toasts.tsx does not call the callback when using the bundled esm npm version.

@Throvn
Copy link
Author

Throvn commented Feb 16, 2023

After migrating to Next.js, toasts are working flawlessly! (For me, at least)
So this has to be some underlying issue, unfortunately I could not figure out how to solve it for client side react.

@dogdogbrother did you set up a new next.js project or did you migrate a CRA project?

@rayli09
Copy link

rayli09 commented Feb 26, 2023

having the same issue here. toasts won't show up in nextjs

@rayli09
Copy link

rayli09 commented Feb 26, 2023

I have a new nextjs project, and the toasts are not showing up

@rayli09
Copy link

rayli09 commented Feb 26, 2023

@Throvn could you provide any hints on how to resolve it?

@Throvn
Copy link
Author

Throvn commented Feb 26, 2023

After I migrated from my CRA project, Toasts suddenly started to work. When I dug into the code I couldn't PinPoint the bug to something specific. However, if you are working on an open source project I could take a look at your code/config and try to spot potential differences.

Honestly, I think the bug is introduced in a compilation step, but this is just a gut feeling. Are you using typescript?

@Sid110307
Copy link

I still have this problem in Next.js 13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants