feat: view config feature flag (#13171)

* feat: add view_configurations feature flag

  - Add feature flag provider and hooks to admin dashboard
  - Add backend API endpoint for feature flags
  - Create view_configurations feature flag (disabled by default)
  - Update order list table to use legacy version when flag is disabled
  - Can be enabled with MEDUSA_FF_VIEW_CONFIGURATIONS=true env var

* fix: naming

* fix: feature flags unauthenticated

* fix: add test
This commit is contained in:
Sebastian Rindom
2025-08-15 08:56:40 +02:00
committed by GitHub
parent 4b3c43fe92
commit ab795bb0a2
8 changed files with 178 additions and 3 deletions
@@ -0,0 +1,22 @@
import { useQuery } from "@tanstack/react-query"
import { sdk } from "../../lib/client"
export type FeatureFlags = {
view_configurations?: boolean
[key: string]: boolean | undefined
}
export const useFeatureFlags = () => {
return useQuery<FeatureFlags>({
queryKey: ["admin", "feature-flags"],
queryFn: async () => {
const response = await sdk.client.fetch<{ feature_flags: FeatureFlags }>("/admin/feature-flags", {
method: "GET",
})
return response.feature_flags
},
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
cacheTime: 10 * 60 * 1000, // Keep in cache for 10 minutes
})
}