Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Cannot read properties of null (reading 'scrollToIndex') #56

Open
agupta-mv opened this issue Jun 15, 2023 · 4 comments
Open

Cannot read properties of null (reading 'scrollToIndex') #56

agupta-mv opened this issue Jun 15, 2023 · 4 comments

Comments

@agupta-mv
Copy link

Hi how are you?
I'm using "@nosferatu500/react-sortable-tree": "^4.4.0",
with react & react-dom version ^18.2.0

TypeError Cannot read properties of null (reading 'scrollToIndex') in
node_modules/@nosferatu500/react-sortable-tree/index.js

Can you help us with this error.

Screenshot 2023-06-15 at 12 59 59 PM

@agupta-mv
Copy link
Author

Screenshot 2023-06-15 at 1 39 05 PM

@nosferatu500
Copy link
Owner

Hello! I just checked it on my end and I don't have any issues.

Can you provide a sandbox example with the issue reproduced?

@agupta-mv
Copy link
Author

When the react sortable tree is mounted and when clicked on tree node, thats when the issue occurs.
Also we havent passed virtuosoRef to react sortable tree.
As we havent passed virtuosoRef prop, there should not be any need of scrollToIndex from this.listRef.
This issue doesnt occur frequently but once in 5 times.
We have attached video demonstrating the occurence of issue.

if (searchFocusTreeIndex !== undefined) {
this.listRef.current.scrollToIndex({
index: searchFocusTreeIndex,
align: 'center'
});
}

can u add scrollToIndex check in the above if condition.

Screen.Recording.2023-06-10.at.4.52.40.PM.mov

@nosferatu500
Copy link
Owner

Should be fixed in v5, but it's still in alpha.

npm i @nosferatu500/[email protected]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants