Skip to content

fix(agent-client): handle missing layout in hook responses#1540

Open
Scra3 wants to merge 1 commit intomainfrom
fix/layout-crash-missing-field
Open

fix(agent-client): handle missing layout in hook responses#1540
Scra3 wants to merge 1 commit intomainfrom
fix/layout-crash-missing-field

Conversation

@Scra3
Copy link
Copy Markdown
Member

@Scra3 Scra3 commented Apr 10, 2026

Summary

  • When a backend returns a response without a layout field (e.g. domain service actions returning only { fields: [...] }), loadInitialState and loadChanges crash with queryResults.layout is not iterable
  • Default layout to [] when missing in both loadInitialState and loadChanges

Test plan

  • All agent-client tests pass
  • New test verifies missing layout is handled gracefully

🤖 Generated with Claude Code

Note

Fix crash in FieldFormStates when hook responses omit the layout property

In field-form-states.ts, spreading undefined on the internal layout array caused a runtime error when load or change hook responses did not include a layout property. Both loadInitialState and setFieldValue now fall back to an empty array when layout is absent, leaving the internal layout empty rather than throwing.

Macroscope summarized 53f9e58.

…ge responses

When the backend returns a response without a layout field (e.g. domain
service actions returning only { fields: [...] }), loadInitialState and
loadChanges crash with "queryResults.layout is not iterable".

Default to empty array when layout is missing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qltysh
Copy link
Copy Markdown

qltysh bot commented Apr 10, 2026

Qlty

Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/agent-client/src/action-fields/field-form-states.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

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.

1 participant