fix: compass-app bug in dismissable homescreen item by miquelbeltran · Pull Request #2449 · flutter/samples · GitHub
Skip to content

fix: compass-app bug in dismissable homescreen item#2449

Merged
miquelbeltran merged 1 commit into
compass-appfrom
mb-fix-dismissable
Sep 25, 2024
Merged

fix: compass-app bug in dismissable homescreen item#2449
miquelbeltran merged 1 commit into
compass-appfrom
mb-fix-dismissable

Conversation

@miquelbeltran

Copy link
Copy Markdown
Member

Doing some testing on the "Optimistic State" I noticed the use of Dismissable was incorrect.

If the delete request failed and the item cannot be removed, the removed item then gets stays in the item list.

This causes the Dismissable widget to throw an exception, because it expects that the item with a unique key has been removed. To fix that, I switched from onDismissed to confirmDismiss, and use the Command status result to know if the dismiss action was successful or not.

I have created a widget test that reproduces the issue.

Pre-launch Checklist

  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I read the Contributors Guide.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-devrel channel on Discord.

@ericwindmill ericwindmill left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. I love that this bug validates the usefulness of commands.

@miquelbeltran miquelbeltran merged commit 6dc8abe into compass-app Sep 25, 2024
@miquelbeltran miquelbeltran deleted the mb-fix-dismissable branch September 25, 2024 14:18
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