Closed humblehacker closed 3 months ago
@humblehacker The publisher emits on willSet
, so I don't think we're doing anything to trigger such a bug. If I had to imagine this is a preview quirk/bug that should probably be filed with Apple.
Since I don't think this is a bug in the library, and since it is a minor issue that only affects previews, I'm going to convert to a discussion. If anyone figures out a workaround that isn't too invasive, we'd be interested in seeing a PR, though!
Description
If I use a publisher on
@Shared(.appStorage(...))
to observe one piece of shared state, changes to any other@Shared(.appStorage(...))
properties will cause that publisher to emit again - but only in Previews on macOS (native or Catalyst).Checklist
main
branch of this package.Expected behavior
Both the app and the preview should have the same behavior: both fields are incremented by 1 on each tap of the increment button.
Actual behavior
In previews on macOS only,
foo
is incremented by 1 whilebar
is incremented by 2.Steps to reproduce
1
ContentView
previewI also added a test that, unless I'm misunderstanding something, should pass but does not.
The Composable Architecture version information
0.11.1
Destination operating system
macOS 14.5
Xcode version information
Version 15.4 (15F31d)
Swift Compiler version information