Skip to content

Conversation

@NishchayRajput
Copy link
Contributor

At home page the OncoTree was rendering multiple time over reaload

Screencast.from.25-01-25.02.40.50.PM.IST.webm

It was due to the useEffect triggering multiple times. So once the tree is initialise it shouldn't be triggered again.
Video after making changes.

Screencast.from.25-01-25.02.41.23.PM.IST.webm

@NishchayRajput
Copy link
Contributor Author

Please review @ritikakundra

@ritikakundra
Copy link
Contributor

adding @bprize15 to this

const versionChanged = dataRef.current !== oncoTreeData;

if (treeContainerRef.current && versionChanged) {
if (treeContainerRef.current && versionChanged && !isInitialized) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will disable the version change functionality so we cannot add this condition.

What you are observing is not a bug. This is due to React's Strict Mode which runs each useEffect twice in development.

However, in production, you can observe a similar bug when you navigate directly to the website without the version URL param first. This is because it fetches the default version automatically, and then again when the version is set via URL param. This is definitely worth looking into. Appreciate the effort!

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.

3 participants