Skip to content

Fixed crash on categories collapse, document sidebar close, resize from desktop to mobile - #5640

Merged
jorgefilipecosta merged 1 commit into
masterfrom
fix/fixed-crash-on-categories-collapse
Mar 15, 2018
Merged

jorgefilipecosta merged 1 commit into
masterfrom
fix/fixed-crash-on-categories-collapse

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Mar 15, 2018 •

Copy link
Copy Markdown
Member

In HierarchicalTermSelector we were not assigning the promise to this.fetchRequest as componentWillUnmount expected.
So each time componentWillUnmount was called the app crashed.

Fixes: #5637

How Has This Been Tested?

Verify it is possible to open and collapse categories panel without any problem.
Verify we can close sidebar with/without categories collapsed, and verify closing sidebar when resizing to mobile also works as expected.
Try to add a category as it generates a different request and see it is still possible to collapse the panel.

@jorgefilipecosta jorgefilipecosta added the [Type] Bug An existing feature does not function as intended label Mar 15, 2018
@jorgefilipecosta jorgefilipecosta self-assigned this Mar 15, 2018
@jorgefilipecosta
jorgefilipecosta requested a review from a team March 15, 2018 16:20
@jorgefilipecosta jorgefilipecosta changed the title Fixed crash on categories collapse. Fixed crash on categories collapse and on document sidebar close. Mar 15, 2018
@jorgefilipecosta jorgefilipecosta changed the title Fixed crash on categories collapse and on document sidebar close. Fixed crash on categories collapse, document sidebar close, resize from desktop to mobile Mar 15, 2018
@jorgefilipecosta jorgefilipecosta added the [Priority] High Used to indicate top priority items that need quick attention label Mar 15, 2018
@aduth

aduth commented Mar 15, 2018

Copy link
Copy Markdown
Member

Expected to have been caused by #5450 (cc @mkaz). Which means, based on the intention of allowing this to more easily allow wp.apiRequest with promise, means that we'll have the same issue for that use-case, since (as may be known), promises are not cancelable, and Promise#abort does not exist.

Really, it speaks to a bigger problem of this approach to making network requests within a component. One which I'd hope will become resolved with changes in direction like #5219

@aduth aduth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Seems we could also consider unsetting this.fetchRequest when the request is completed, so we're not needlessly causing abort (not that I expect it has much overhead).

…re not assigning the promise to this.fetchRequest as componentWillUnmount expected.
@jorgefilipecosta
jorgefilipecosta force-pushed the fix/fixed-crash-on-categories-collapse branch from b12f615 to e0fff87 Compare March 15, 2018 21:38
@jorgefilipecosta
jorgefilipecosta merged commit 41f7feb into master Mar 15, 2018
@jorgefilipecosta
jorgefilipecosta deleted the fix/fixed-crash-on-categories-collapse branch March 15, 2018 21:48
@jorgefilipecosta

Copy link
Copy Markdown
Member Author

Thank you for the review @aduth, I applied your suggestion of unsetting the variable when the requests are finished.

@mkaz

mkaz commented Mar 15, 2018

Copy link
Copy Markdown
Member

@aduth - yeh, I had to add in checks for .abort() existing to avoid the errors.

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

Labels

[Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closing Categories box errors

3 participants