You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Address potential preview warnings
We currently allow folks to use `prepareDependencies` in the body of a
preview, which works great. It does appear that previews have gotten
fancier, especially in Xcode 26, where a preview session stays live even
during changes to view code. These changes cause the preview body to
re-evaluate, triggering `prepareDependencies` all over again, and
spitting out a large purple warning into the preview console.
The behavior of `prepareDependencies` is to ignore future calls and
surface warnings in to catch misuse, but maybe we should only emit these
warnings in the application. Preview environments are a bit treacherous
as is, with app entry point code leaking into them, and preview trait
code executing across multiple previews in a file. And so this branch
proposes silencing this warning in previews entirely.
Alternatives:
- We could shorten the warning to a one-liner. Something like "Xcode
Preview: 'prepareDependencies' already called this session. Ignoring."
- We could stop showing 'prepareDependencies' as a legit tool for
previews and instead push people towards 'withDependencies', though
this is not great for ergonomics, especially in non-single entry point
systems.
Bonus change:
This PR also updates the warning about ignoring app entry point
dependencies in previews with instructions on how to suppress. But given
the above, maybe we actually want to suppress this warning entirely?
* Remove preview warning
It's not super helpful in practice.
0 commit comments