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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling early <body> changes #1754

Merged
merged 5 commits into from
Feb 20, 2020
Merged

Handling early <body> changes #1754

merged 5 commits into from
Feb 20, 2020

Conversation

alexreardon
Copy link
Collaborator

Follow up #1751

Adding a test to catch any errors caused by the body changing just before an unmount

/cc @sdb1228

// Remove from body
getBodyElement().removeChild(el);
// checking if element exists as the body might have been changed by thinks like 'turbolinks'
const body: HTMLBodyElement = getBodyElement();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I found another culprit

Copy link
Contributor

Choose a reason for hiding this comment

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

May want to change to things instead of thinks in the comment :)

@@ -59,26 +59,6 @@ it('should remove the element when unmounting after a timeout', () => {
expect(getElement('5')).not.toBeTruthy();
});

it('should not remove the element when unmounting after a timeout if the element does not exist', () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed this test in favour of one that catches any issues for all the components

@alexreardon alexreardon changed the title Html dumping Handling early <body> removal Feb 20, 2020
if (getBodyElement().contains(el)) {
// not clearing the ref as it might have been set by a new effect
getBodyElement().removeChild(el);
// checking if element exists as the body might have been changed by thinks like 'turbolinks'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you mean things not thinks here :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks! changed

});

forEachSensor((control: Control) => {
it('should have any errors when body is changed just before unmount: mid drag', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

💯 to this test. Much better sorry I should have probably just migrated it here :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All good! I wanted to get yours in and see if i could make it catch every component

Copy link
Contributor

@sdb1228 sdb1228 left a comment

Choose a reason for hiding this comment

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

LGTM That test is much better!

@alexreardon alexreardon changed the title Handling early <body> removal Handling early <body> changes Feb 20, 2020
@alexreardon alexreardon merged commit 293dbc1 into master Feb 20, 2020
@alexreardon alexreardon deleted the html-dumping branch February 20, 2020 02:55
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