Skip to content
Snippets Groups Projects
Commit b0407ece authored by unarist's avatar unarist Committed by Eugen Rochko
Browse files

Fix an error when ancestors get loaded before the status itself (#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.
parent 9b3d8ee3
No related branches found
No related tags found
No related merge requests found
...@@ -240,9 +240,9 @@ export default class Status extends ImmutablePureComponent { ...@@ -240,9 +240,9 @@ export default class Status extends ImmutablePureComponent {
} }
componentDidUpdate () { componentDidUpdate () {
const { ancestorsIds } = this.props; const { status, ancestorsIds } = this.props;
if (ancestorsIds && ancestorsIds.size > 0) { if (status && ancestorsIds && ancestorsIds.size > 0) {
const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size]; const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size];
element.scrollIntoView(); element.scrollIntoView();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment