Closed austenem closed 1 month ago
Does it make sense to make these all into hooks and move the calls to useSnackbarActions
?
Does it make sense to make these all into hooks and move the calls to
useSnackbarActions
?
So something like:
const useWorkspaceUpdateSuccessToast = () => {
return () => toastSuccess('Workspace successfully updated.');
};
for each of these in useSnackbarActions()
?
Yeah, but likely using useCallback
with useSnackbarActions
in its dependency array. What do you think? It would push all of the logic into the one file, but we don't necessarily have to address it in this PR.
Would having the toast functions be in the dependency array be cleaner? For example, having the following in useSnackbarActions()
:
const useWorkspacesDeleteErrorToast = useCallback(() => {
return (names: string) => toastError(`Error deleting workspaces: ${names}`);
}, [toastError]);
So that they can be all be pulled out of useSnackbarActions()
instead of imported individually?
Yep! That's what I meant, but struggled to communicate. Thanks!
Something like:
function useWorkspacesDeleteErrorToast() {
const {toastError} = useSnackbarActions();
return useCallback( (names: string) => {
toastError(`Error deleting workspaces: ${names}`);
}, [toastError]);
}
Ah, ok - so just to clarify, in the example you gave it looks like these hooks would be defined outside of useSnackbarActions()
and imported individually?
I think I prefer your suggestion. A central hook which returns the various functions. Thanks! Sorry for the confusion.
Thanks for reviewing!
Summary
Updates workspace success toasts to indicate whether the workspace has launched in a new tab. Additionally, updates logic to show this toast not just when a workspace is created, but any time a workspace is launched.
Design Documentation/Original Tickets
CAT-867 Jira ticket
Testing
Tested various entry points for the toast:
"Workspace successfully created."
+ launch dialog, then if launched"Workspace successfully launched..."
"Workspace successfully launched..."
"Workspace successfully launched..."
"Workspace successfully launched..."
Screenshots/Video
Checklist
CHANGELOG-your-feature-name-here.md
is present in the root directory, describing the change(s) in full sentences.