Computations created outside a render will never be disposed.
Just wondering whether I can ignore this warning or if its potentially a problem.
Basically I have some tab components that are being created in a function and managed in a signal. When a tab is opened I add it to the array and when its closed I remove it from the array.
Is the memory handled by the garbage collector when I remove it from tabs array or is the warning related to something else im missing?
8 Replies
loadSire
's content is created outside of a root, hence the error
I'd suggest rethinking loadSire
so that the JSX stays in the JSX, and not separate from itI know thats where the warning is coming from, but was hoping it could be ignored as im keeping track of them
for example:
wouldnt that rerender every time a new tab is added tho? the point is to avoid rerendeing as there is a lot of data in each tab
No it wouldn't.
ill give it a try just now
actually going to be a bit of a pain to change as different content in the first two tabs
im not understanding why there wouldn't be a rerender tho, doesn't the for loop rerun every time tabs() triggers?
what I have current is this, so when it triggers there is no recreation of the content component:
doesn't the for loop rerun every time tabs() triggers?Nope, that only happens when you do
tabs().map(...)
. For
compares each item in the given list and does the following:
- moves elements that changed index
- inserts new elements
- removes elements no longer in the arrayah thats cool, will spend some time reworking it today then
Followed your advice and it worked, no more warning, and no rerenders. Thanks