Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Frame/Loading] Fix async setState calls #4158

Merged
merged 1 commit into from
May 7, 2021
Merged

Conversation

AndrewMusgrave
Copy link
Member

@AndrewMusgrave AndrewMusgrave commented May 4, 2021

WHY are these changes introduced?

Loading can call set state after the component has unmounted

Screen Shot 2021-05-04 at 10 47 32 AM

WHAT is this pull request doing?

Adding an isMounted check

How to 馃帺

Unfortunately it's very hard to reproduce the error. @dleroux did you want to check it in off your branch?

@@ -1,14 +1,15 @@
import React, {useEffect, useState} from 'react';
Copy link
Member Author

Choose a reason for hiding this comment

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

I would have loved to write a test for this, but I can't get the component in the proper state.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, tests would be nice but I think this is pretty straightforward.

@github-actions
Copy link
Contributor

github-actions bot commented May 4, 2021

馃煝 This pull request modifies 2 files and might impact 1 other files.

Details:
All files potentially affected (total: 1)
馃搫 UNRELEASED.md (total: 0)

Files potentially affected (total: 0)

馃З src/components/Frame/components/Loading/Loading.tsx (total: 1)

Files potentially affected (total: 1)

Copy link
Contributor

@dleroux dleroux left a comment

Choose a reason for hiding this comment

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

I'm going to approve this because it's straightforward and should be put in place. It's hard to reproduce the error but it's clear what needs to be done. 馃檶

@AndrewMusgrave AndrewMusgrave force-pushed the fix-async-loading branch 2 times, most recently from 2c422a6 to 161e094 Compare May 5, 2021 14:12
@AndrewMusgrave AndrewMusgrave merged commit baef27e into main May 7, 2021
@AndrewMusgrave AndrewMusgrave deleted the fix-async-loading branch May 7, 2021 16:17
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.

None yet

2 participants