Skip to content

Revert "Fix crash on state reset when preferences are queried"#441

Open
dfabulich wants to merge 1 commit into
skiptools:mainfrom
dfabulich:revert-pr-418
Open

Revert "Fix crash on state reset when preferences are queried"#441
dfabulich wants to merge 1 commit into
skiptools:mainfrom
dfabulich:revert-pr-418

Conversation

@dfabulich
Copy link
Copy Markdown
Contributor

@dfabulich dfabulich commented May 19, 2026

This reverts commit 23cf094 (PR #418).

Fixes #440

This PR may feel a bit trollish, but, I think it might actually be the right thing to do.

#418 caused #440 by reading preference state (thus declaring a dependency on that state) while constructing a nav entry, triggering a recomposition infinite loop. I've only come up with one good way to accomplish what #418 accomplishes without reading the state… and that's to clean up the state in Main.kt.

Remember, the reason we couldn't reproduce #300 or #417 is that Showcase's Main.kt had SideEffect { saveableStateHolder.removeState(true) } in it. In #418, @marcprux commented:

As mentioned at #417 (comment), we don't see this in Showcase due to skiptools/skipapp-showcase@5bb3049#diff-e7075a061fc36788a2762feb445a61db436a6f07c529859334189e53914a04f7R53 which adds to Main.kt:

SideEffect { saveableStateHolder.removeState(true) }

I wonder if we should be adding that to every project's Main.kt, @aabewhite?

We already do add that to every project's Main.kt. Abe updated the project template to add that line in October 2024. skiptools/skipstone@f53a2ce It shipped as part of skip 1.7.0.

PR #418 is a heroic attempt to fix #300 / #417 without requiring users to update their Main.kt file. But, since that causes #440, I think users should just update their Main.kt files, instead. (Maybe we could/should add a skip verify step to check for this or something.)

To be clear, here are my test results:

  1. When I run my 300 repro test on main skip-ui and main Showcase, it passes.
  2. When I revert 418 in skip-ui and run my 300 repro test on main Showcase, it still passes, because of SideEffect { saveableStateHolder.removeState(true) } in Main.kt.
  3. When I run my 300 repro test on main skip-ui and remove SideEffect { saveableStateHolder.removeState(true) } from Showcase's Main.kt, it still passes, because 418 is doing its job.
  4. Only when I both revert 418 and remove SideEffect { saveableStateHolder.removeState(true) }, then my 300 repro test fails.

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
  • REQUIRED: I have checked whether this change requires a corresponding update in the Skip Fuse UI repository (link related PR if applicable)
    Not required
  • OPTIONAL: I have added an example of any UI changes to the Showcase sample app

  • 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.

@cla-bot cla-bot Bot added the cla-signed label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant