adding the ability for notifications to auto hide when they close#523
adding the ability for notifications to auto hide when they close#523AnnMarieW merged 5 commits intosnehilvj:masterfrom
Conversation
…eps from showing up unexpectedly
| switch (action) { | ||
| case "show": | ||
| notifications.show(others); | ||
| notifications.show({...others, onClose}); |
There was a problem hiding this comment.
how about making it {onClose, ...others} incase we get the functions as props working in a future version?
There was a problem hiding this comment.
At that point, we will need to rework this anyways. As you wont be able to declare the name twice, plus this default behaviour should stay unless explicitly dont not to auto remove from the tree... At which time, this would trigger the event passed to the props while maintaining the original removal.
|
What are your thoughts on adding a prop for a dev to be able to opt out of this? Where the prop would stay as they added without it auto Not sure why the dev would want this behaviour though... |
|
This does not need an opt-out. If it did, to be consistent we should in fact re-show the notification immediately when it's closed, because internally it still thinks its action is The only thing I'm wondering is if Anyway that's probably a bigger task than you want to do right now... it must already work (ie be a no-op) to re-show an already-visible notification or you'd have seen that bug pop up way sooner, so this seems like it'll work if people use it in simple ways, but there are very likely other bugs hiding out in more complex use cases. So I'd say go for it, merge this as a fix but down the line we can think about a cleaner pattern. |
Co-authored-by: Alex Johnson <alex@plot.ly>
|
Believe this issue stems from treating an underlying I recommend that we shift to treating the I also agree that this should be fine the way it is for now. This is a little more work than what we'd like to do currently and this PR solves the immediate issue. |
|
Thanks @BSd3v and @alexcjohnson |
keeps from showing up unexpectedly