Fix Frontend modules tests (#2688)

* Fix naming issue

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix more tests

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Revert unnecessary changes

Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Refactor according to self-review

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: gitstart-twenty <twenty@gitstart.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>

* Fix graphql mocks not working anymore

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
gitstart-twenty
2023-11-29 04:18:34 +05:45
committed by GitHub
parent fd969de311
commit 0fa55b0634
25 changed files with 693 additions and 313 deletions

View File

@ -1,4 +1,4 @@
import { useRecoilState, useSetRecoilState } from 'recoil';
import { useRecoilCallback, useSetRecoilState } from 'recoil';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
@ -9,9 +9,7 @@ import { isCommandMenuOpenedState } from '../states/isCommandMenuOpenedState';
import { Command } from '../types/Command';
export const useCommandMenu = () => {
const [isCommandMenuOpened, setIsCommandMenuOpened] = useRecoilState(
isCommandMenuOpenedState,
);
const setIsCommandMenuOpened = useSetRecoilState(isCommandMenuOpenedState);
const setCommands = useSetRecoilState(commandMenuCommandsState);
const {
setHotkeyScopeAndMemorizePreviousScope,
@ -28,13 +26,17 @@ export const useCommandMenu = () => {
goBackToPreviousHotkeyScope();
};
const toggleCommandMenu = () => {
const toggleCommandMenu = useRecoilCallback(({ snapshot }) => async () => {
const isCommandMenuOpened = snapshot
.getLoadable(isCommandMenuOpenedState)
.getValue();
if (isCommandMenuOpened) {
closeCommandMenu();
} else {
openCommandMenu();
}
};
});
const addToCommandMenu = (addCommand: Command[]) => {
setCommands((prev) => [...prev, ...addCommand]);