[Snackbar] Add a simple notification method(), showing global Snackbars (especially for reducers)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Summary 💡
Current scenerio 😯
Currently, in MUI we only have snackbars that should be used in such a way that can be rendered as HTML (JSX syntax) i.e
<Snackbar
open={open}
autoHideDuration={6000}
onClose={handleClose}
message="Note archived"
action={action}
/>
OR
<Alert severity="error">This is an error message!</Alert>
New and required behavior 🤔
But what if we have to generate a snackbar from within the reducer i.e
name: "userMatches",
initialState: {
matchesData: {
matches: [],
},
},
reducers: {
getMatches: (state, { payload }) => {
state.loading = true;
},
getMatchesSuccess: (state, { payload }) => {
state.loading = false;
state.matchesData.matches = payload.matchData;
},
getMatchesFailed: (state, { payload }) => {
state.loading = false;
👉 // notification.error(payload.message);
👉 notification.success(payload.message);
},
}
})
So currently we are not able to do that in reducers and have to install another package, or have to create the global and to do a bunch of stuff to achieve the functionality
Sumup 🙌
A simple calling method to show the notification or snackbar for some specific task, a method that can be called from anywhere of the application
Examples 🌈
No response
Motivation 🔦
We can check this scenario working here, as Antd implemented it
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing Snackbar and Alert usage, then compare the requested reducer call pattern with Ant Design's notification API. Done means a globally callable notification method can show success and error snackbars from application code, including reducers, without requiring each caller to render a Snackbar.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100