donatso / family-chart

family tree visualization built on top of d3
MIT License
179 stars 63 forks source link

How to perform clean up in useEffect #2

Closed AllStackDev1 closed 2 years ago

AllStackDev1 commented 2 years ago

so when I use state to toggle between views, it crashes when I try mounting back a tree component, works the first time but going back I get this.

image

Need a way to clean up when unmounting.

donatso commented 2 years ago

It seems that your family tree json is corrupted. I am not sure what is causing it. Can you try to isolate the problem?

AllStackDev1 commented 2 years ago

So what i figured out was that the tree overwrite the source json data. so i try to not make a direct reference to it, using json.parse(json.stringfy(data)). it solved it. thanks

On Mon, Jan 24, 2022 at 7:08 PM donatso @.***> wrote:

It seems that your family tree json is corrupted. I am not sure what is causing it. Can you try to isolate the problem?

— Reply to this email directly, view it on GitHub https://github.com/donatso/family-chart/issues/2#issuecomment-1020390565, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXX5S74GTWKG7U7UMGTGGDUXWIQDANCNFSM5MV774XQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>