Open talpx0 opened 9 months ago
Do you use it in app
folder or pages
folder? next-mdx-remote
doesn't have any cache mechanism, but Nextjs
has in app router. I suppose your issue is not related with next-mdx-remote
.
The fileSet
is useless because the heading element can not know the others' fileSet
value, which is scoped variable. Each heading element creates its own empty set.
Do you use it in
app
folder orpages
folder?next-mdx-remote
doesn't have any cache mechanism, butNextjs
has in app router. I suppose your issue is not related withnext-mdx-remote
.The
fileSet
is useless because the heading element can not know the others'fileSet
value, which is scoped variable. Each heading element creates its own empty set.
I think you are correct , I use next 14 and app router , everytime I refresh , the fileSet will become a closure (it didn't get memory free), and it will keep update the uniquePath = ${slug}-${counter}
like : a-1 -> refresh -> a-2 -> refresh -> a-3 ,
I only use this for heading on current page only , So , It only checks the current path's md content , thanks
And, one more thing. You don't need to implement the unique url, fileset etc. There are some remark plugins to do so for you.
basically I fixed error after move the "const fileSet:Set = new Set()" into return function like this , before , it is a closure and I don't know why it will cause memory leak ? is it because of mdx remote have cache mechanism , and it will cache the state instead of clean it ?