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

fix: merge feature flags with returned values from API to enrich flag availability in config #5291

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions packages/config/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const resolveConfig = async function (opts) {
mode,
debug,
logs,
featureFlags,
featureFlags: passedFeatureFlags,
} = await normalizeOpts(optsA)

const { siteInfo, accounts, addons, integrations } = await getSiteInfo({
Expand All @@ -72,10 +72,15 @@ export const resolveConfig = async function (opts) {
mode,
offline,
siteFeatureFlagPrefix,
featureFlags,
featureFlags: passedFeatureFlags,
testOpts,
})

// Feature flags can also be loaded from the call to `getSiteInfo()`, in the CLI
// these won't be accessible within the calls to `netlify-config` as they're fetched
// too late. We merge them here to ensure they're available to this package.
const featureFlags = { ...passedFeatureFlags, ...(siteInfo.feature_flags ?? {}) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need this fallback?

Suggested change
const featureFlags = { ...passedFeatureFlags, ...(siteInfo.feature_flags ?? {}) }
const featureFlags = { ...passedFeatureFlags, ...siteInfo.feature_flags }


const { defaultConfig: defaultConfigA, baseRelDir: baseRelDirA } = parseDefaultConfig({
defaultConfig,
base,
Expand Down
Loading