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

toast.update (unexpectedly) requires container id #1080

Open
janpaepke opened this issue Mar 7, 2024 · 1 comment
Open

toast.update (unexpectedly) requires container id #1080

janpaepke opened this issue Mar 7, 2024 · 1 comment

Comments

@janpaepke
Copy link

janpaepke commented Mar 7, 2024

Do you want to request a feature or report a bug?
I'm pretty sure this is an unintentional bug.

What is the current behavior?
When specifying a containerId when caling toast(), an update to the resulting toastID will fail silently (it just does nothing).

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

The code below fails, which at least to me is unexpected as toastIDs are globally unique, not per container.

const currentID = toast('first', {
	containerId: 'chat',
});

setTimeout(() => {
	toast.update(currentID, {
		render: 'second',
	});
}, 2000);

See here for the codesandbox example.

What is the expected behavior?
I would expect the update to work without passing the containerId.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
independent of React.

@aemendes
Copy link

aemendes commented Mar 9, 2024

Currently facing the same problem.

In my case when toaster.update is at same level of ToasterContainer I have this problem. If i move toaster.update to some downstream children it starts working as expected.

I can see that containerIds are well generated without having any conflict, just the rendering is not working as expected.

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

2 participants