Skip to content

Commit

Permalink
Merge pull request #75 from bholmesdev/fix/query-view-transitions
Browse files Browse the repository at this point in the history
fix: check for fallback when using view transitions event
  • Loading branch information
bholmesdev authored Jul 22, 2024
2 parents 431b203 + 56a4000 commit 702d09e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/metal-sloths-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"simple-stack-query": patch
---

fixes issue where `$.ready` does not fire in Safari or Firefox when using Astro view transitions with `fallback="none"`
5 changes: 4 additions & 1 deletion packages/query/src/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export function create$(scope: typeof scopeFn) {
return [...document.querySelectorAll(selector)];
},
ready(callback: () => MaybePromise<undefined | (() => void)>) {
if (transitionEnabledOnThisPage()) {
const fallback = document
.querySelector('meta[name="astro-view-transitions-fallback"]')
?.getAttribute("content");
if (transitionEnabledOnThisPage() && fallback !== "none") {
let cleanup: (() => void) | undefined;

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

0 comments on commit 702d09e

Please sign in to comment.