fix: update to astro-island
This commit is contained in:
parent
068c706bbb
commit
045d7bb73f
1 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,7 @@ export default () =>
|
||||||
beforeDiff(doc) {
|
beforeDiff(doc) {
|
||||||
for (const island of doc.querySelectorAll('astro-root')) {
|
for (const island of doc.querySelectorAll('astro-root')) {
|
||||||
const uid = island.getAttribute('uid');
|
const uid = island.getAttribute('uid');
|
||||||
const current = document.querySelector(`astro-root[uid="${uid}"]`);
|
const current = document.querySelector(`astro-island[uid="${uid}"]`);
|
||||||
if (current) {
|
if (current) {
|
||||||
current.dataset.persist = true;
|
current.dataset.persist = true;
|
||||||
island.replaceWith(current);
|
island.replaceWith(current);
|
||||||
|
@ -13,9 +13,9 @@ export default () =>
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
afterDiff() {
|
afterDiff() {
|
||||||
for (const island of document.querySelectorAll('astro-root')) {
|
for (const island of document.querySelectorAll('astro-island')) {
|
||||||
delete island.dataset.persist;
|
delete island.dataset.persist;
|
||||||
}
|
}
|
||||||
window.dispatchEvent(new CustomEvent('astro:locationchange'));
|
window.dispatchEvent(new CustomEvent('astro:hydrate'));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue