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 an error when ancestors get loaded before the status itself #5312

Merged
merged 1 commit into from
Oct 11, 2017

Conversation

unarist
Copy link
Contributor

@unarist unarist commented Oct 11, 2017

When ancestors get loaded, we scroll to the target status (i.e. skip ancestors). However, ancestors may get loaded before the status itself, then it causes TypeError because this.node is undefined yet.

react-dom.production.min.js:187 TypeError: Cannot read property 'querySelectorAll' of undefined
    at t.componentDidUpdate (index.js:246)
    at commitLifeCycles (react-dom.production.min.js:169)
    at n (react-dom.production.min.js:180)
    at c (react-dom.production.min.js:183)
    at l (react-dom.production.min.js:184)
    at m (react-dom.production.min.js:188)
    at h (react-dom.production.min.js:187)
    at Object.enqueueSetState (react-dom.production.min.js:140)
    at l.o.setState (react.production.min.js:12)
    at l.onStateChange (connectAdvanced.js:205)

Since we don't show anything until the status gets loaded, we don't need to scroll to the target status in this time. If we get the status itself later, it causes componentDidUpdate and scrolling correctly.

@unarist unarist added bug Something isn't working ui Front-end, design labels Oct 11, 2017
When ancestors get loaded, we scroll to the target status (i.e. skip
ancestors). However, ancestors may get loaded before the status itself,
then it causes TypeError because `this.node` is undefined yet.

Since we don't show anything until the status gets loaded, we don't need
to scroll to the target status in this time. If we get the status itslef
later, it causes `componentDidUpdate` and scrolling correctly.
@Gargron Gargron merged commit b0407ec into mastodon:master Oct 11, 2017
cobodo pushed a commit to cobodo/mastodon that referenced this pull request Oct 20, 2017
…odon#5312)

When ancestors get loaded, we scroll to the target status (i.e. skip
ancestors). However, ancestors may get loaded before the status itself,
then it causes TypeError because `this.node` is undefined yet.

Since we don't show anything until the status gets loaded, we don't need
to scroll to the target status in this time. If we get the status itslef
later, it causes `componentDidUpdate` and scrolling correctly.
@unarist unarist deleted the fix/rapid-context branch September 29, 2018 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ui Front-end, design
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants