Skip to content

Snackbar shown again on popBackstack() #961

Open
@kosavsech

Description

// Check if there's a userMessage to show to the user
val currentOnUserMessageDisplayed by rememberUpdatedState(onUserMessageDisplayed)
LaunchedEffect(userMessage) {
if (userMessage != 0) {
viewModel.showEditResultMessage(userMessage)
currentOnUserMessageDisplayed()
}
}

This part of code being legitimately trigger by
onTaskUpdate = {
navActions.navigateToTasks(
if (taskId == null) ADD_EDIT_RESULT_OK else EDIT_RESULT_OK
)
},
or
onDeleteTask = { navActions.navigateToTasks(DELETE_RESULT_OK) }

But after you can go to task details again and click go back arrow in top bar.
topBar = {
TaskDetailTopAppBar(onBack = onBack, onDelete = viewModel::deleteTask)
},

Last snackbar message will be shown again. But this time, in my opinion, because there is copy of route with USER_MESSAGE_ARG in backstack.

How this can be fixed or bypassed?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions