Skip to content

Commit

Permalink
fix(frontend): close button on error bar (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
shini4i authored May 5, 2024
1 parent bc27578 commit 26505c8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions web/src/ErrorContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ export const ErrorProvider = ({ children }) => {
);
};

const clearMessage = (status, message) => {
setStack(stack => {
for (let id in stack) {
if (stack[id].status === status && stack[id].message === message) {
delete stack[id];
}
}
return { ...stack };
});
};

const value = useMemo(() => ({
stack,
messages: Object.keys(stack).reduce((result, key) => {
Expand Down Expand Up @@ -62,6 +73,7 @@ export const ErrorProvider = ({ children }) => {
return { ...stack };
});
},
clearMessage,
}), [stack]);

return (
Expand Down

0 comments on commit 26505c8

Please sign in to comment.