Skip to content

Commit 702d09e

Browse files
authored
Merge pull request #75 from bholmesdev/fix/query-view-transitions
fix: check for fallback when using view transitions event
2 parents 431b203 + 56a4000 commit 702d09e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/metal-sloths-occur.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"simple-stack-query": patch
3+
---
4+
5+
fixes issue where `$.ready` does not fire in Safari or Firefox when using Astro view transitions with `fallback="none"`

packages/query/src/internal.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export function create$(scope: typeof scopeFn) {
2525
return [...document.querySelectorAll(selector)];
2626
},
2727
ready(callback: () => MaybePromise<undefined | (() => void)>) {
28-
if (transitionEnabledOnThisPage()) {
28+
const fallback = document
29+
.querySelector('meta[name="astro-view-transitions-fallback"]')
30+
?.getAttribute("content");
31+
if (transitionEnabledOnThisPage() && fallback !== "none") {
2932
let cleanup: (() => void) | undefined;
3033

3134
document.addEventListener("astro:page-load", async () => {

0 commit comments

Comments
 (0)