Skip to content

refactor(frontend): remove unused preset wrapper state - #9382

Merged
aglinxinyuan merged 5 commits into
apache:mainfrom
aglinxinyuan:codex/refactor/preset-wrapper-unused-state
Nov 10, 2026
Merged

aglinxinyuan merged 5 commits into
apache:mainfrom
aglinxinyuan:codex/refactor/preset-wrapper-unused-state

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Remove the preset wrapper's write-only base state, unused typing subscription, unreachable search branch, constant menu flag with its nzVisible binding, and unused template index. Opening and save events still refresh the preset list, which is now a readonly Preset[] holding the arrays the service emits rather than copies of them; apply/save/delete behavior is preserved. A field without parent.fieldGroup is still rejected at initialization, now by the guard with a message, before the preset fetch subscribes, instead of by a TypeError from a discarded filterPresetFromForm() call. +18/−196 lines.

The menu flag has never been enabled by production code, and the base state has no live reader. Both were introduced in #1164 on January 13, 2022.

Any related issues, documentation, discussions?

Closes #9379.

How was this PR tested?

From frontend/:

node .yarn/releases/yarn-4.14.1.cjs format:ci
node node_modules/typescript/bin/tsc --noEmit -p src/tsconfig.app.json
node node_modules/typescript/bin/tsc --noEmit -p src/tsconfig.spec.json
node .yarn/releases/yarn-4.14.1.cjs build:ci
node node_modules/@angular/cli/bin/ng.js test --watch=false --include=src/app/common/formly/preset-wrapper/preset-wrapper.component.spec.ts --include=src/app/workspace/service/preset/preset.service.spec.ts --include=src/app/workspace/component/property-editor/operator-property-edit-frame/operator-property-edit-frame.component.spec.ts

350 passed; one existing skipped case. Removing the parent.fieldGroup check from the guard fails only its initialization test.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Codex (GPT-6), Claude Code (Claude Opus 5.5)

The wrapper never enables its search filter, and basePreset has no live reader. Keep the existing dropdown refresh, preset actions and initialization validation while removing that unused state and its subscriptions.
@aglinxinyuan aglinxinyuan added refactor Refactor the code frontend Changes related to the frontend GUI labels Nov 9, 2026
Copilot AI balanced review requested due to automatic review settings November 9, 2026 08:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot removed the refactor Refactor the code label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @mengw15, @Yicong-Huang
    You can notify them by mentioning @mengw15, @Yicong-Huang in a comment.

@codecov-commenter

codecov-commenter commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.87%. Comparing base (cfca8e1) to head (7f3b0e8).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9382      +/-   ##
============================================
+ Coverage     91.81%   91.87%   +0.05%     
+ Complexity     5019     4968      -51     
============================================
  Files          1277     1280       +3     
  Lines         56369    56037     -332     
  Branches       7364     7293      -71     
============================================
- Hits          51755    51482     -273     
+ Misses         2759     2729      -30     
+ Partials       1855     1826      -29     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø) Carriedforward from c6a4645
agent-service 99.53% <ø> (-0.01%) ⬇️ Carriedforward from c6a4645
amber 85.91% <ø> (+0.13%) ⬆️ Carriedforward from c6a4645
computing-unit-managing-service 64.00% <ø> (-0.06%) ⬇️ Carriedforward from c6a4645
config-service 87.50% <ø> (-0.24%) ⬇️ Carriedforward from c6a4645
file-service 82.27% <ø> (-0.04%) ⬇️ Carriedforward from c6a4645
frontend 96.53% <100.00%> (-0.01%) ⬇️
notebook-migration-service 83.77% <ø> (ø) Carriedforward from c6a4645
pyamber 98.46% <ø> (-0.04%) ⬇️ Carriedforward from c6a4645
workflow-compiling-service 77.47% <ø> (-0.84%) ⬇️ Carriedforward from c6a4645

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kunwp1 kunwp1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Reject a field without parent.fieldGroup in the init guard, with a
message, instead of through the discarded filterPresetFromForm() call.
Type searchResults as readonly Preset[] so both refreshes assign the
fetched arrays directly, drop the constant nzVisible binding, and remove
the spec cases that could no longer fail together with the stub's
unused applyPresetStream.
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 10, 2026
Merged via the queue into apache:main with commit a302e9d Nov 10, 2026
23 checks passed
@aglinxinyuan
aglinxinyuan deleted the codex/refactor/preset-wrapper-unused-state branch November 10, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unreachable preset wrapper state and search

4 participants