mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-02-07 09:34:19 +01:00
This commit fixes a panic that occurred when the application was started
for the first time with no real accounts. The panic was:
"Widget 9AEC changed layer_id during the frame from LayerId { Background 9AEC }
to LayerId { Foreground 7E24 }"
Root cause:
- The previous implementation called route_to() during the Initializing state
- This happened during the first frame render, triggering navigation animations
- egui-nav attempted to render widgets on different layers during the transition
- This violated egui's requirement that widgets must stay on the same layer
Solution:
- Added a `need_account_redirect` flag to defer navigation until after first frame
- During initialization, we now set the flag instead of calling route_to()
- In the Initialized state, we check the flag and perform the navigation
- This ensures navigation happens after the first frame completes, avoiding layer conflicts
The fix resolves the crash while maintaining the desired behavior of automatically
redirecting users to the add account screen when no real accounts exist.