Skip to content

docs(store): clarify ifLet vs observe re-fire semantics - #3961

Draft
aryansk wants to merge 1 commit into
pointfreeco:mainfrom
aryansk:codex/tca-3871-iflet-observe-refire
Draft

docs(store): clarify ifLet vs observe re-fire semantics#3961
aryansk wants to merge 1 commit into
pointfreeco:mainfrom
aryansk:codex/tca-3871-iflet-observe-refire

Conversation

@aryansk

@aryansk aryansk commented Aug 11, 2026

Copy link
Copy Markdown

Summary

Enhances the deprecated Store.ifLet(then:else:) message to call out the core semantic difference from its suggested replacement observe { if let store.scope } :

  • ifLet(then:else:) fires only on nil/non-nil transitions (via removeDuplicates by presence).
  • observe { if let store.scope } re-fires on any child state mutation while non-nil.

Callers that recreate views/controllers inside the observe body see duplicates (the reported UIKit bug). The new message directs authors to distinguish the optional's presence from child mutations or to gate recreation on the optional's identity.

Issue

Addresses #3871 — migration from ifLet(then:else:) to observe duplicates work on child mutations.

Validation

  • git diff --check passes
  • Deprecation-message-only change; no behavioral code change

The deprecated Store.ifLet only fires on nil/non-nil transitions
(removeDuplicates by presence), while the suggested
observe { if let store.scope } re-fires on any child state
mutation. Callers recreating views/controllers inside observe
see duplicates; gate on the optional's identity instead.

Refs pointfreeco#3871
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