diff --git a/.changeset/orange-vans-turn.md b/.changeset/orange-vans-turn.md new file mode 100644 index 0000000000..685847496e --- /dev/null +++ b/.changeset/orange-vans-turn.md @@ -0,0 +1,5 @@ +--- +"@commercetools-frontend/application-shell": patch +--- + +Remove usage of query to load menu feature toggles. diff --git a/@types-extensions/graphql-proxy/index.d.ts b/@types-extensions/graphql-proxy/index.d.ts index 19b56d7019..021f1cf201 100644 --- a/@types-extensions/graphql-proxy/index.d.ts +++ b/@types-extensions/graphql-proxy/index.d.ts @@ -1,14 +1,6 @@ /* THIS IS A GENERATED FILE */ /* eslint-disable import/no-duplicates */ -declare module '*/fetch-all-menu-feature-toggles.proxy.graphql' { - import { DocumentNode } from 'graphql'; - const defaultDocument: DocumentNode; - export const FetchAllMenuFeatureToggles: DocumentNode; - - export default defaultDocument; -} - declare module '*/fetch-applications-menu.proxy.graphql' { import { DocumentNode } from 'graphql'; const defaultDocument: DocumentNode; diff --git a/packages/application-shell/src/components/application-shell/application-shell.spec.js b/packages/application-shell/src/components/application-shell/application-shell.spec.js index 9c5ac3e61b..098d486b1e 100644 --- a/packages/application-shell/src/components/application-shell/application-shell.spec.js +++ b/packages/application-shell/src/components/application-shell/application-shell.spec.js @@ -191,11 +191,6 @@ const getDefaultMockResolvers = (mocks = {}) => { }) ) ), - graphql - .link(`${window.location.origin}/api/graphql`) - .query('FetchAllMenuFeatureToggles', (req, res, ctx) => - res(ctx.data({ allFeatureToggles: [] })) - ), ]; }; const mockServer = setupServer( @@ -1344,11 +1339,6 @@ describe('navbar menu links interactions', () => { }) ) ), - graphql - .link(`${window.location.origin}/api/graphql`) - .query('FetchAllMenuFeatureToggles', (req, res, ctx) => - res(ctx.data({ allFeatureToggles: [] })) - ), ...getDefaultMockResolvers() ); }); diff --git a/packages/application-shell/src/components/setup-flop-flip-provider/setup-flop-flip-provider.tsx b/packages/application-shell/src/components/setup-flop-flip-provider/setup-flop-flip-provider.tsx index 2ac9a45077..663e456d08 100644 --- a/packages/application-shell/src/components/setup-flop-flip-provider/setup-flop-flip-provider.tsx +++ b/packages/application-shell/src/components/setup-flop-flip-provider/setup-flop-flip-provider.tsx @@ -16,7 +16,6 @@ import { GRAPHQL_TARGETS, featureFlags, } from '@commercetools-frontend/constants'; -import useAllMenuFeatureToggles from '../../hooks/use-all-menu-feature-toggles'; import type { TAllFeaturesQuery, TFetchLoggedInUserQuery, @@ -122,7 +121,6 @@ export const SetupFlopFlipProvider = (props: TSetupFlopFlipProviderProps) => { TAdditionalEnvironmentProperties['enableLongLivedFeatureFlags'], TAdditionalEnvironmentProperties >((context) => context.environment.enableLongLivedFeatureFlags); - const allMenuFeatureToggles = useAllMenuFeatureToggles(); const flags = useMemo( () => ({ ...featureFlags.FLAGS, @@ -141,10 +139,9 @@ export const SetupFlopFlipProvider = (props: TSetupFlopFlipProviderProps) => { const defaultFlags = useMemo( () => ({ ...featureFlags.DEFAULT_FLAGS, - ...allMenuFeatureToggles.allFeatureToggles, ...props.defaultFlags, }), - [allMenuFeatureToggles.allFeatureToggles, props.defaultFlags] + [props.defaultFlags] ); const adapterArgs = useMemo( @@ -222,7 +219,7 @@ export const SetupFlopFlipProvider = (props: TSetupFlopFlipProviderProps) => { shouldDeferAdapterConfiguration={ typeof props.shouldDeferAdapterConfiguration === 'boolean' ? props.shouldDeferAdapterConfiguration - : !props.user || allMenuFeatureToggles.isLoading + : !props.user } > {props.children} diff --git a/packages/application-shell/src/hooks/use-all-menu-feature-toggles/fetch-all-menu-feature-toggles.proxy.graphql b/packages/application-shell/src/hooks/use-all-menu-feature-toggles/fetch-all-menu-feature-toggles.proxy.graphql deleted file mode 100644 index be28e8981c..0000000000 --- a/packages/application-shell/src/hooks/use-all-menu-feature-toggles/fetch-all-menu-feature-toggles.proxy.graphql +++ /dev/null @@ -1,3 +0,0 @@ -query FetchAllMenuFeatureToggles { - allFeatureToggles -} diff --git a/packages/application-shell/src/hooks/use-all-menu-feature-toggles/index.ts b/packages/application-shell/src/hooks/use-all-menu-feature-toggles/index.ts deleted file mode 100644 index e3e1d8a2ad..0000000000 --- a/packages/application-shell/src/hooks/use-all-menu-feature-toggles/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './use-all-menu-feature-toggles'; diff --git a/packages/application-shell/src/hooks/use-all-menu-feature-toggles/use-all-menu-feature-toggles.spec.js b/packages/application-shell/src/hooks/use-all-menu-feature-toggles/use-all-menu-feature-toggles.spec.js deleted file mode 100644 index 18ba63ff8a..0000000000 --- a/packages/application-shell/src/hooks/use-all-menu-feature-toggles/use-all-menu-feature-toggles.spec.js +++ /dev/null @@ -1,109 +0,0 @@ -import { reportErrorToSentry } from '@commercetools-frontend/sentry'; -import { screen, renderApp, waitFor } from '../../test-utils'; -import FetchAllMenuFeatureToggles from './fetch-all-menu-feature-toggles.proxy.graphql'; -import useAllMenuFeatureToggles from './use-all-menu-feature-toggles'; - -jest.mock('@commercetools-frontend/sentry'); - -const TestComponent = () => { - const { isLoading, allFeatureToggles } = useAllMenuFeatureToggles(); - - if (!isLoading) { - return ( - <> -