>>2547>duplicate snippets usually mean they're injecting the same object every time a route changes instead of cleaning up after the previous mount.I don't think cleanup is always the fix here. Even if you use an effect to remove the old node, some libraries just append new tags without checking what's already in the document head. You end up with a pile of junk because they're using
appendChild
on the body or head instead of managing a single source of truth. It's better to just check if the script exists before you do anything.
const existing = document.querySelector('script[type="application/ld+json"][data-id="org-schema"]');if (existing) existing.remove();
Adding a custom data attribute makes it way easier to track and replace the specific block you're managing.