Skip to content

Fix empty NavDisplay backstack by removing redundant onBack calls#523

Merged
rteyssandier merged 2 commits into
openflocon:mainfrom
mikef-dk:bugfix/empty-navdisplay-backstack
May 12, 2026
Merged

Fix empty NavDisplay backstack by removing redundant onBack calls#523
rteyssandier merged 2 commits into
openflocon:mainfrom
mikef-dk:bugfix/empty-navdisplay-backstack

Conversation

@mikef-dk
Copy link
Copy Markdown
Contributor

@mikef-dk mikef-dk commented May 8, 2026

Starting with version 1.8.0 of Flocon everytime the Panel is closed an IllegalArgumentException is thrown:

java.lang.IllegalArgumentException: NavDisplay backstack cannot be empty
	at androidx.navigation3.ui.NavDisplayKt__NavDisplayKt.NavDisplay(NavDisplay.kt:359)
	at androidx.navigation3.ui.NavDisplayKt.NavDisplay(Unknown Source)
	at androidx.navigation3.ui.NavDisplayKt__NavDisplayKt.NavDisplay$lambda$4$NavDisplayKt__NavDisplayKt(NavDisplay.kt)
	at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:204)
	at androidx.compose.runtime.GapComposer.recomposeToGroupEnd(GapComposer.kt:1678)
	at androidx.compose.runtime.GapComposer.skipCurrentGroup(GapComposer.kt:2014)
	at androidx.compose.runtime.GapComposer.doCompose-aFTiNEg(GapComposer.kt:2655)
	at androidx.compose.runtime.GapComposer.recompose-aFTiNEg$runtime(GapComposer.kt:2577)

This should be related to the fact that onBack was triggered multiple times. Removing it from the onClick callbacks fixes this issue.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes redundant onBack() calls in PanelScene.kt to prevent double-navigation when hiding a panel. The reviewer noted a similar issue in the EscapeHandler of FloconPanel.kt that should be addressed to prevent potential crashes when closing the panel with the Escape key.

@mikef-dk mikef-dk changed the title Fix empty NavDisplay backstack by removing redundant onBack calls in … Fix empty NavDisplay backstack by removing redundant onBack calls May 8, 2026
@rteyssandier rteyssandier merged commit 8802a49 into openflocon:main May 12, 2026
2 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.

2 participants