Skip to content

fix(@angular-devkit/core): only invoke smart default provider when value is undefined - #34537

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-smart-defaults-lazy
Oct 27, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-smart-defaults-lazy

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Previously, CoreSchemaRegistry._applySmartDefaults invoked the smart default provider unconditionally before CoreSchemaRegistry._set checked whether the target property already had a defined value. This caused smart default providers to be evaluated even when an option was explicitly provided.

…lue is undefined

Previously, `CoreSchemaRegistry._applySmartDefaults` invoked the smart default provider unconditionally before `CoreSchemaRegistry._set` checked whether the target property already had a defined value. This caused smart default providers to be evaluated even when an option was explicitly provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CoreSchemaRegistry to defer the execution of smart default providers. Instead of immediately invoking the provider, a lazy function is passed to _set, which is only evaluated and resolved (including handling Observables) if the target property is actually undefined or forced. This prevents unnecessary provider calls when a value is already explicitly defined. A corresponding unit test has been added to verify this behavior. There are no review comments to address.

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Oct 27, 2026
@alan-agius4
alan-agius4 requested a review from clydin October 27, 2026 09:49
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 27, 2026
@alan-agius4
alan-agius4 merged commit c44762f into angular:main Oct 27, 2026
43 checks passed
@alan-agius4
alan-agius4 deleted the fix-smart-defaults-lazy branch October 27, 2026 13:48
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular-devkit/core target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants