Skip to content

fix(vtable): update nested fields by path - #5305

Open
biubiukam wants to merge 1 commit into
VisActor:developfrom
biubiukam:fix/issue-4186-nested-field-update
Open

fix(vtable): update nested fields by path#5305
biubiukam wants to merge 1 commit into
VisActor:developfrom
biubiukam:fix/issue-4186-nested-field-update

Conversation

@biubiukam

Copy link
Copy Markdown
Contributor

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Site / documentation update
  • Demo update
  • Workflow
  • Chore
  • Release
  • Other (about what?)

🔗 Related issue link

fixes #4186

💡 Background and solution

changeFieldValue and changeFieldValueByRecordIndex treated nested FieldDef values as literal keys. For a field such as facts.2025-02.qty, the update therefore wrote record["facts.2025-02.qty"] instead of updating the nested quantity. The corresponding ListTable change events also read direct keys, so their old and changed values could be incorrect.

This change adds shared nested-field read and write handling for dotted paths and string[] paths. It preserves existing literal dotted-key precedence, creates missing intermediate objects, keeps numeric-string conversion behavior, and uses the same path resolution for hasField, column lookup, and change-event values.

Regression tests cover dotted and array paths, missing intermediate objects, literal-key precedence, and single/batch change-event payloads.

📝 Changelog

Language Changelog
🇺🇸 English Fix updates for nested fields represented by dotted or array paths, including accurate change-event values.
🇨🇳 Chinese 修复通过点号路径或数组路径更新嵌套字段,并确保变更事件中的新旧值准确。

☑️ Self-Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

✅ Verification

  • Focused regression tests: 2 suites, 12 tests passed, covering dotted and array paths plus single/batch event payloads.
  • Full @visactor/vtable Jest suite: 75 suites, 326 tests passed.

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

@biubiukam
biubiukam marked this pull request as ready for review September 4, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 嵌套属性的编辑更新的属性错误

1 participant