change the feature flag mechanism

Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
Benjamin authored and Claude committed 2026-07-20 09:28:14 +00:00
1 parent 135c9bcd93
commit 1af829818c
1 file changed
+13 -2
@@ -1,12 +1,23 @@
import { useFlag } from 'common'
import { useSelectedOrganizationQuery } from './useSelectedOrganization'
/**
* Whether the Warehouse product is enabled for the current session.
*
* Gates every Warehouse surface while in preview: the table Storage section ("Copy to Warehouse"),
* the per-table storage chips/badges, the Warehouse Catalog integration, and the Connect-sheet
* catalog tab. Backed by the `warehouse` ConfigCat flag (defaults to off until registered).
* catalog tab. Backed by the `warehouse` ConfigCat flag, configured as a comma-separated
* organization slug allowlist. Use `all` to enable every organization.
*/
export function useIsWarehouseEnabled(): boolean {
return useFlag<boolean>('warehouse') === true
const flagValue = useFlag('warehouse')
const { data: organization } = useSelectedOrganizationQuery()
const allowedOrgSlugs =
typeof flagValue === 'string' ? flagValue.split(',').map((slug) => slug.trim()) : []
if (allowedOrgSlugs.includes('all')) return true
return allowedOrgSlugs.includes(organization?.slug ?? '')
}