Skip to content

feat: add $resolvedId property to entity handles#17

Closed
vparys wants to merge 1 commit intomainfrom
feat/resolved-id-property
Closed

feat: add $resolvedId property to entity handles#17
vparys wants to merge 1 commit intomainfrom
feat/resolved-id-property

Conversation

@vparys
Copy link
Copy Markdown
Member

@vparys vparys commented Apr 13, 2026

Summary

  • Adds $resolvedId getter to EntityHandle, HasOneHandle, and PlaceholderHandle — returns the persisted (server-assigned) ID if available, otherwise the original ID
  • Simplifies the common pattern of entity.$persistedId ?? entity.id into a single property
  • Updates EntityRefInterface and HasOneRefInterface types and collector proxy accordingly

Test plan

  • Unit tests for $resolvedId after temp ID mapping returns persisted ID
  • Unit tests for $resolvedId without mapping returns original ID
  • Unit tests for stable id after persisted ID mapping
  • Typecheck passes
  • All existing tests pass

Adds a `$resolvedId` getter that returns the best-known ID for an entity:
the server-assigned (persisted) ID if available, otherwise the original ID.
This simplifies the common pattern of `entity.$persistedId ?? entity.id`.
@vparys
Copy link
Copy Markdown
Member Author

vparys commented Apr 13, 2026

Resolved in #20

@vparys vparys closed this Apr 13, 2026
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