Skip to content

Fix @Observable property writes skipped when new value is == old value#25

Open
dfabulich wants to merge 1 commit into
skiptools:mainfrom
dfabulich:observed-referential-equality
Open

Fix @Observable property writes skipped when new value is == old value#25
dfabulich wants to merge 1 commit into
skiptools:mainfrom
dfabulich:observed-referential-equality

Conversation

@dfabulich

@dfabulich dfabulich commented Jun 10, 2026

Copy link
Copy Markdown
Member

Compose mutableStateOf uses structural equality by default, so assigning a new dictionary (or other collection) to an @Observable property was ignored when Equatable said nothing changed.

Now, we use referential equality, so assignment always updates the backing state.

Fixes #24

Skip Pull Request Checklist:

  • REQUIRED: I have signed the Contributor Agreement
  • REQUIRED: I have tested my change locally with swift test
  • OPTIONAL: I have tested my change on an iOS simulator or device
  • OPTIONAL: I have tested my change on an Android emulator or device

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Tested using skiptools/skipapp-showcase#110

Compose `mutableStateOf` uses structural equality by default, so assigning a new dictionary (or other collection) to an `@Observable` property was ignored when `Equatable` said nothing changed.

Now, we use referential equality, so assignment always updates the backing state.

Fixes skiptools#24
@cla-bot cla-bot Bot added the cla-signed label Jun 10, 2026
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.

@Observable dictionary replace ignored when struct values compare equal

1 participant