Skip to content

Use default key base when loading shared readers - #234

Merged
stephencelis merged 4 commits into
pointfreeco:mainfrom
ibrahimkteish:bugfix/default-key-base-lookup
Jul 31, 2026
Merged

stephencelis merged 4 commits into
pointfreeco:mainfrom
ibrahimkteish:bugfix/default-key-base-lookup

Conversation

@ibrahimkteish

Copy link
Copy Markdown
Contributor

Fixes #233.

SharedReader.load(_:) and SharedReader.init(require:) currently use a SharedReaderKey.Default wrapper as the persistent-reference lookup key, while the synchronous default-key initializer uses key.base.

Mixing these APIs therefore looks up the same ID using different concrete key types, creating a second reference and subscription.

This adds K.Default overloads that forward to key.base, matching the existing initializer behavior. It also adds regression tests covering both load and require followed by a property-wrapper reader.

@ibrahimkteish
ibrahimkteish marked this pull request as ready for review July 28, 2026 14:20
@stephencelis

Copy link
Copy Markdown
Member

@ibrahimkteish Thanks for looking into this! Looks like there may be parallel work to do in SharedKey.swift for parity (at least the init(require:), and maybe load too).

@ibrahimkteish

Copy link
Copy Markdown
Contributor Author

@stephencelis done

@ibrahimkteish
ibrahimkteish force-pushed the bugfix/default-key-base-lookup branch from 3277de6 to a058049 Compare July 31, 2026 07:16

@stephencelis stephencelis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@stephencelis
stephencelis merged commit bce82f2 into pointfreeco:main Jul 31, 2026
12 checks passed
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.

Multiple subscriptions for same ID when using load + PropertyWrapper

2 participants