Skip to content

Commit bdc3598

Browse files
committed
fix(plan): normalize the runtime feature flag to a boolean
1 parent f54ff0e commit bdc3598

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎apps/sim/lib/core/config/env-flags.test.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@ vi.hoisted(() => {
77
vi.stubEnv('NEXT_PUBLIC_APP_URL', 'https://self-hosted.example')
88
vi.stubEnv('NEXT_PUBLIC_FORCE_HOSTED', 'true')
99
vi.stubEnv('NODE_ENV', 'production')
10+
vi.stubEnv('MSHIP_PLAN_MODE', 'true')
1011
})
1112

1213
vi.unmock('@/lib/core/config/env')
1314
vi.unmock('@/lib/core/config/env-flags')
1415

15-
import { isHosted, isProd } from '@/lib/core/config/env-flags'
16+
import { isHosted, isPlanModeEnabled, isProd } from '@/lib/core/config/env-flags'
1617

1718
describe('hosted detection', () => {
1819
it('follows the configured URL and ignores the development override in production', () => {
1920
expect(isProd).toBe(true)
2021
expect(isHosted).toBe(false)
2122
})
2223
})
24+
25+
describe('Plan mode deployment flag', () => {
26+
it('normalizes the runtime string to the boolean required by mode selectors', () => {
27+
expect(isPlanModeEnabled).toBe(true)
28+
})
29+
})

‎apps/sim/lib/core/config/env-flags.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,4 +729,5 @@ export const isLiveEnterpriseSearchEnabled =
729729

730730
/** Private organizational planning, enabled only by this deployment. */
731731
export const isPlanModeEnabled =
732-
typeof window === 'undefined' && (env.MSHIP_PLAN_MODE ?? process.env.NODE_ENV === 'development')
732+
typeof window === 'undefined' &&
733+
(envBoolean(env.MSHIP_PLAN_MODE) ?? process.env.NODE_ENV === 'development')

0 commit comments

Comments
 (0)