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

fix: Move all componentWillUnMount functionality to respective events #1544

Merged
merged 4 commits into from
Jun 5, 2020

Conversation

harshithpabbati
Copy link
Contributor

Closes #1515
Move all functionality from componentWillUnMount lifecycle

@acao can you review this PR

@harshithpabbati harshithpabbati changed the title chore: Move all componentWillUnMount functionality to respective events fix: Move all componentWillUnMount functionality to respective events May 22, 2020
@acao
Copy link
Member

acao commented May 22, 2020

awesome work @harshithpabbati !

we just need to make sure to debounce the more high-throughput events to avoid performance/render-blocking issues, as invoking lots of storage.set() events can sometimes lead to issues like that

as for the delay, 500-1000ms should be fine. these values only need to be persisted in case the user navigates away or refreshes. this will essentially delay the write until the user has finished, or if there's lots of dragging or variables editing going on, it will only write to ls every 500ms-1000ms, rather than writing to localstorage 60 times a second or more

@harshithpabbati
Copy link
Contributor Author

@acao should I debounce the whole function ?

@harshithpabbati harshithpabbati force-pushed the unmounted branch 2 times, most recently from 9ba87c3 to 1bb1813 Compare May 22, 2020 13:55
@acao
Copy link
Member

acao commented May 22, 2020

@harshithpabbati no, only the storage write events

@harshithpabbati
Copy link
Contributor Author

@harshithpabbati no, only the storage write events

ok, I will update that

@acao
Copy link
Member

acao commented May 22, 2020

if you debounce the setState() events, we get weird issues with resizing panes as you can see

@harshithpabbati
Copy link
Contributor Author

if you debounce the setState() events, we get weird issues with resizing panes as you can see

oh, yeah true 👍

@acao
Copy link
Member

acao commented May 22, 2020

@harshithpabbati why did you close this PR?

@acao acao reopened this May 22, 2020
@harshithpabbati
Copy link
Contributor Author

@harshithpabbati why did you close this PR?

That's because we found a better solution than this.

@acao
Copy link
Member

acao commented May 22, 2020

@harshithpabbati i'm not sure that's the case, we just found a better way to reproduce the error. is there a conversation that i did't see where you and Mateo decided his solution was better?

@harshithpabbati
Copy link
Contributor Author

Oh is it ? Then cool!

@harshithpabbati
Copy link
Contributor Author

@harshithpabbati i'm not sure that's the case, we just found a better way to reproduce the error. is there a conversation that i did't see where you and Mateo decided his solution was better?

No, we didn't have any discussion

@acao
Copy link
Member

acao commented May 22, 2020

@harshithpabbati yes, as i mentioned in discord, we will wait until both solutions are ready, and make sure we can reproduce the error with both and see if one doesn't solve it better than the other. both proposals are welcome.

@harshithpabbati
Copy link
Contributor Author

Done updated @acao :)

@acao
Copy link
Member

acao commented May 22, 2020

looking good @harshithpabbati !

as a rule of thumb, any event that has its events triggered many many times a second, such as resize or keyboard stroke, should debounce all the localStorage.setItem() calls (via storage.set())

@harshithpabbati
Copy link
Contributor Author

looking good @harshithpabbati !

as a rule of thumb, any event that has its events triggered many many times a second, such as resize or keyboard stroke, should debounce all the localStorage.setItem() calls (via storage.set())

Sure, I will update it soon

@harshithpabbati
Copy link
Contributor Author

@acao is this PR helpful ?

@acao
Copy link
Member

acao commented Jun 4, 2020

@harshithpabbati it might still be?

@acao
Copy link
Member

acao commented Jun 4, 2020

lol oops! tried merging via UI, fixing it now. gonna try and see if this resolves our user's issue

@acao
Copy link
Member

acao commented Jun 4, 2020

@harshithpabbati fixed it! merging soon

@harshithpabbati
Copy link
Contributor Author

harshithpabbati commented Jun 4, 2020

lol oops! tried merging via UI, fixing it now. gonna try and see if this resolves our user's issue

Hope this solves the issue. It will and it should ofcourse

@acao acao merged commit 046b09f into graphql:master Jun 5, 2020
Copy link
Member

@acao acao left a comment

Choose a reason for hiding this comment

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

awesome work! everything looks to be operating as it should be

thenamankumar pushed a commit to thenamankumar/graphiql that referenced this pull request Aug 30, 2020
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.

Warning: Can't perform a React state update on an unmounted component
2 participants