Skip to content

Commit

Permalink
Fix actions setter when opening the command menu (#8263)
Browse files Browse the repository at this point in the history
Fix standard actions overriding navigate and create commands when
opening the command menu.

Before fix:
<img width="493" alt="Capture d’écran 2024-10-31 à 18 08 56"
src="https://github.com/user-attachments/assets/015bd798-baa4-4f84-8886-e355c0ef1455">

After fix:
<img width="499" alt="Capture d’écran 2024-10-31 à 18 08 34"
src="https://github.com/user-attachments/assets/02ba7fc4-ec90-4c13-9830-d884c0da37d9">

---------

Co-authored-by: Charles Bochet <[email protected]>
  • Loading branch information
bosiraphael and charlesBochet authored Nov 5, 2024
1 parent 88d6f5e commit 9b0c742
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ApolloProvider } from '@/apollo/components/ApolloProvider';
import { CommandMenuEffect } from '@/app/effect-components/CommandMenuEffect';
import { GotoHotkeysEffectsProvider } from '@/app/effect-components/GotoHotkeysEffectsProvider';
import { PageChangeEffect } from '@/app/effect-components/PageChangeEffect';
import { AuthProvider } from '@/auth/components/AuthProvider';
Expand Down Expand Up @@ -44,7 +43,6 @@ export const AppRouterProviders = () => {
<DialogManager>
<StrictMode>
<PromiseRejectionEffect />
<CommandMenuEffect />
<GotoHotkeysEffectsProvider />
<PageTitle title={pageTitle} />
<Outlet />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const useCommandMenu = () => {
}),
);

const commands = Object.values(COMMAND_MENU_COMMANDS);

const actionCommands = actionMenuEntries
.getValue()
?.map((actionMenuEntry) => ({
Expand All @@ -53,7 +55,7 @@ export const useCommandMenu = () => {
type: CommandType.Action,
}));

setCommands(actionCommands);
setCommands([...commands, ...actionCommands]);
}

setIsCommandMenuOpened(true);
Expand All @@ -76,11 +78,17 @@ export const useCommandMenu = () => {

if (isCommandMenuOpened) {
setIsCommandMenuOpened(false);
setCommands([]);
resetSelectedItem();
goBackToPreviousHotkeyScope();
}
},
[goBackToPreviousHotkeyScope, resetSelectedItem, setIsCommandMenuOpened],
[
goBackToPreviousHotkeyScope,
resetSelectedItem,
setCommands,
setIsCommandMenuOpened,
],
);

const toggleCommandMenu = useRecoilCallback(
Expand Down

0 comments on commit 9b0c742

Please sign in to comment.