Skip to content

Commit

Permalink
Sync: Adds support for data-astro-rerun (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp authored Mar 23, 2024
1 parent 213aa81 commit bfb7994
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/witty-pants-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro-vtbot": patch
---

Sync: Adds support for data-astro-rerun
4 changes: 3 additions & 1 deletion components/swap-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ type SavedFocus = {
export const disarmKnownScripts = (doc: Document) => {
[...doc.scripts].forEach((newScript) => {
newScript.dataset.astroExec = '';
const found = [...document.scripts].find((oldScript) => oldScript.isEqualNode(newScript));
const found =
!newScript.hasAttribute('data-astro-rerun') &&
[...document.scripts].find((oldScript) => oldScript.isEqualNode(newScript));
if (!found) delete newScript.dataset.astroExec;
});
};
Expand Down

0 comments on commit bfb7994

Please sign in to comment.