Skip to content

fix: fix incorrect dev config types and netlify dev regression - #7135

Merged
serhalp merged 2 commits into
mainfrom
fix/7124
Mar 25, 2025
Merged

serhalp merged 2 commits into
mainfrom
fix/7124

Conversation

@serhalp

@serhalp serhalp commented Mar 25, 2025

Copy link
Copy Markdown
Member

Summary

Fixes #7124.

The regression was introduced here: https://github.com/netlify/cli/pull/7112/files#r2005549184. The detected framework config's pollingStrategies property was no longer being threaded through correctly.

This was introduced because the DevConfig type was incorrect and the weak type assertion (and general type weakness in this codebase) allowed it.

This also fixes a few nearby type isues.

The regression was introduced here: https://github.com/netlify/cli/pull/7112/files#r2005549184.

This was introduced because the `DevConfig` type was incorrect and the weak type assertion
(and general type weakness in this codebase) allowed it.

This also fixes a few nearby type isues.
@github-actions

Copy link
Copy Markdown

📊 Benchmark results

Comparing with 719c17c

  • Dependency count: 1,173 (no change)
  • Package size: 297 MB (no change)
  • Number of ts-expect-error directives: 715 (no change)

@@ -8,23 +8,14 @@ export type BuildConfig = NonNullable<NetlifyTOML['build']>
export type DevConfig = NonNullable<NetlifyTOML['dev']> & {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You can see here we're extending this type, but we were duplicating most of it here. Most of this diff is cleaning up this unnecessary duplication + adding undefined to optional properties.


jwtSecret: string
jwtRolePath: string
pollingStrategies?: PollingStrategy[]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

dist: devConfig.publish || getDefaultDist(workingDir),
framework: '#custom',
pollingStrategies: devConfig.pollingStrategies?.map((s) => s.name) ?? [],
pollingStrategies: devConfig.pollingStrategies ?? [],

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the regression/fix

Comment thread src/utils/types.ts
Comment on lines -15 to +16
pollingStrategies: { name: string }[]
pollingStrategies: PollingStrategy[]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This one was correct. I made it reference the canonical type while I was here.

@serhalp
serhalp marked this pull request as ready for review March 25, 2025 20:33
@serhalp
serhalp requested a review from a team as a code owner March 25, 2025 20:33
@serhalp
serhalp enabled auto-merge (squash) March 25, 2025 22:48
@serhalp
serhalp merged commit ad197f7 into main Mar 25, 2025
@serhalp
serhalp deleted the fix/7124 branch March 25, 2025 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Never ending "Waiting for framework" in 19.0.3

3 participants