-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uprade app components to react md2 (#604)
Signed-off-by: Carl Gieringer <78054+carlgieringer@users.noreply.github.com>
- Loading branch information
1 parent
16ab570
commit 8972248
Showing
20 changed files
with
291 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useAddMessage } from "@react-md/alert"; | ||
import { useEffect } from "react"; | ||
import app from "./app/appSlice"; | ||
import { useAppDispatch } from "./hooks"; | ||
|
||
/** | ||
* This component is a hack to work around react-md's Toast/Snackbar/Alert design | ||
* where it is only possible to add messages from a functional component. Since | ||
* we want to add messages from sagas, we need to capture the addMessage function. | ||
* | ||
* TODO(#605) figure out a better approach to app toasts. | ||
*/ | ||
export function AddMessageCapturer() { | ||
const addMessage = useAddMessage(); | ||
const dispatch = useAppDispatch(); | ||
// Only capture addMessage once. | ||
useEffect(() => { | ||
if (addMessage) { | ||
dispatch(app.captureAddMessage(addMessage)); | ||
} | ||
}, [addMessage, dispatch]); | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.