Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: to remove query to load menu feature toggles #3578

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/orange-vans-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@commercetools-frontend/application-shell": patch
---

Remove usage of query to load menu feature toggles.
8 changes: 0 additions & 8 deletions @types-extensions/graphql-proxy/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -122,7 +121,6 @@ export const SetupFlopFlipProvider = (props: TSetupFlopFlipProviderProps) => {
TAdditionalEnvironmentProperties['enableLongLivedFeatureFlags'],
TAdditionalEnvironmentProperties
>((context) => context.environment.enableLongLivedFeatureFlags);
const allMenuFeatureToggles = useAllMenuFeatureToggles();
const flags = useMemo(
() => ({
...featureFlags.FLAGS,
Expand All @@ -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(
Expand Down Expand Up @@ -222,7 +219,7 @@ export const SetupFlopFlipProvider = (props: TSetupFlopFlipProviderProps) => {
shouldDeferAdapterConfiguration={
typeof props.shouldDeferAdapterConfiguration === 'boolean'
? props.shouldDeferAdapterConfiguration
: !props.user || allMenuFeatureToggles.isLoading
: !props.user
}
>
{props.children}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions packages/application-shell/src/types/generated/proxy.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.