Skip to content

fix: bug causing permanent CircularProgressIndicator when referenced board is deleted fixes #2001#2011

Closed
sshdopey wants to merge 4 commits intoAppFlowy-IO:mainfrom
sshdopey:fix/referenced_board_deletion
Closed

fix: bug causing permanent CircularProgressIndicator when referenced board is deleted fixes #2001#2011
sshdopey wants to merge 4 commits intoAppFlowy-IO:mainfrom
sshdopey:fix/referenced_board_deletion

Conversation

@sshdopey
Copy link
Contributor

If you add a referenced board or grid to a document and delete the board, the document will have a permanent circular progress indicator.

This pull request fixes a bug where deleting a referenced board results in a permanent circular progress indicator on the page. The issue occurs because the app is not handling the case where the referenced board is deleted.

To fix this issue, I added a check for whether the referenced board is null. If it is null, I returned SizedBox.shrink() to remove the board from the page. Additionally, I added a check for if the FutureBuilder has an error, and returned SizedBox.shrink() in that case as well.

I tested this fix by creating a new board, referencing it on a page, deleting the board, closing and reopening the app, and checking that the circular progress indicator was no longer present.

Please review and merge this pull request.

Thank you!

@CLAassistant
Copy link

CLAassistant commented Mar 17, 2023

CLA assistant check
All committers have signed the CLA.

@annieappflowy annieappflowy requested a review from a-wallen March 17, 2023 08:30
@annieappflowy annieappflowy added grid features related to the table-view database kanban board features related to the board-view database labels Mar 17, 2023
Copy link
Contributor

@a-wallen a-wallen left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the quick turnaround. See my comments and address them as you see fit.

Co-authored-by: Alex Wallen <wallenstephen@outlook.com>
@sshdopey
Copy link
Contributor Author

Thanks for the correction, I learnt something from that stackoverflow anwer.

@sshdopey sshdopey changed the title Fixed bug causing permanent CircularProgressIndicator when referenced board is deleted fixes #2001 fix: bug causing permanent CircularProgressIndicator when referenced board is deleted fixes #2001 Mar 17, 2023
@sshdopey
Copy link
Contributor Author

All checks completed. I hope it's okay now. I still am open for advice and correction

@a-wallen
Copy link
Contributor

a-wallen commented Mar 17, 2023

@DestinedCodes do you think that you can add a test for this PR? FYI it looks good to me, but a test would be nice so that the codebase doesn't regress.

@sshdopey
Copy link
Contributor Author

TBH, I have never written a test case before now. I only came across this issue as a github octern applicant.
I am going to take my time and figure out how to add the test case. Just give me some few hours.

The skills i have learnt and honed during the last and current week are something I'll always be grateful for.

YES I think I can add a test case for the PR.😊

@a-wallen
Copy link
Contributor

I just worked on an integration test that uses commands from the slash menu. I think you might want to look at this file to help create your test frontend/appflowy_flutter/integration_test/slash_command_test.dart.

@a-wallen
Copy link
Contributor

fixes #2001

@sshdopey
Copy link
Contributor Author

I am still working on the test, I am not done yet.
I'll try my best to finish it as soon as I can.

if (board != null) {
return _build(context, board);
}
return const SizedBox.shrink();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I'm a fan of this solution.

I would prefer that deleting a Page would also remove it from any documents which might reference it.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, the backend can either return a board, null, or error so the widget still needs to account for this case. This solution will do for now.

Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com>
@a-wallen
Copy link
Contributor

@DestinedCodes, we still want this change! Please reach out on Discord if you need help with the test!

@Xazin
Copy link
Contributor

Xazin commented Apr 10, 2023

Hey @DestinedCodes, if you need help with the tests let us know, I can help write some tests if you want, and open a PR to your branch on your fork.

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

Labels

grid features related to the table-view database kanban board features related to the board-view database

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants