Skip to content

fix(frontend): keep integer property fields editable by replacing the crashing Formly number parser#6058

Open
yangzhang75 wants to merge 1 commit into
apache:mainfrom
yangzhang75:fix/integer-property-input-parser
Open

fix(frontend): keep integer property fields editable by replacing the crashing Formly number parser#6058
yangzhang75 wants to merge 1 commit into
apache:mainfrom
yangzhang75:fix/integer-property-input-parser

Conversation

@yangzhang75

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Fixes typed edits being ignored on integer/number operator property fields (reproduced
on the Limit operator): the field gets stuck and only the +/- steppers work.

Root cause: @ngx-formly/core's json-schema integer/number parser reads
document.querySelector('#' + field.id).validity.badInput, assuming the id is on the
native <input>. ng-zorro's nz-input-number puts the id on its host element (which
has no .validity), so the parser throws Cannot read properties of undefined (reading 'badInput') whenever the parsed value is null (an intermediate state while
typing). The typed value then never commits.

This replaces that parser, for numeric fields only, with a null-safe parser that does
no DOM access (applySafeNumericParser in jsonSchemaMapIntercept). The stepper path
was unaffected and keeps working.

Any related issues, documentation, discussions?

Closes #6054

How was this PR tested?

  • New unit tests for parseNumericInput (numeric/decimal/negative/whitespace/empty/
    non-numeric/DOM-safety) and applySafeNumericParser (replaces the crash-prone parser,
    null-safe on the clear-field case, leaves non-numeric fields untouched) — 12 tests.
  • Existing OperatorPropertyEditFrameComponent spec still passes.
  • Manually verified in the UI: integer fields (e.g. Limit) are editable by typing again
    and the console badInput TypeError is gone.

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

Generated-by: Claude Code (Claude Opus 4.8)

… crashing Formly number parser

@ngx-formly/core's json-schema integer/number parser reads
document.querySelector('#'+field.id).validity.badInput, assuming the id is on the
native <input>. ng-zorro's nz-input-number puts the id on its host element, which has
no .validity, so the parser throws 'Cannot read properties of undefined (reading
badInput)' whenever the parsed value is null (an intermediate state while typing).
Typed edits then never commit and the field is stuck (only the +/- steppers work).

Replace the numeric fields' parser in jsonSchemaMapIntercept with a null-safe parser
that does no DOM access.
@github-actions github-actions Bot added fix frontend Changes related to the frontend GUI labels Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 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: @SarahAsad23
    You can notify them by mentioning @SarahAsad23 in a comment.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.40%. Comparing base (878eb8a) to head (0595606).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6058      +/-   ##
============================================
+ Coverage     56.37%   56.40%   +0.02%     
  Complexity     2992     2992              
============================================
  Files          1129     1130       +1     
  Lines         43802    43816      +14     
  Branches       4743     4749       +6     
============================================
+ Hits          24695    24714      +19     
+ Misses        17658    17650       -8     
- Partials       1449     1452       +3     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 878eb8a
agent-service 44.59% <ø> (ø) Carriedforward from 878eb8a
amber 57.37% <ø> (ø) Carriedforward from 878eb8a
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 878eb8a
config-service 52.30% <ø> (ø) Carriedforward from 878eb8a
file-service 62.81% <ø> (ø) Carriedforward from 878eb8a
frontend 50.13% <100.00%> (+0.06%) ⬆️
notebook-migration-service 78.57% <ø> (ø) Carriedforward from 878eb8a
pyamber 91.15% <ø> (ø) Carriedforward from 878eb8a
python 90.69% <ø> (ø) Carriedforward from 878eb8a
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 878eb8a

*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.

@yangzhang75

Copy link
Copy Markdown
Contributor Author

/request-review @mengw15

@github-actions github-actions Bot requested a review from mengw15 July 2, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Number/integer property fields (e.g. Limit) can't be edited by typing — Formly integer parser throws on nz-input-number

2 participants