diff --git a/.changeset/wild-chicken-matter.md b/.changeset/wild-chicken-matter.md new file mode 100644 index 000000000..3a1bbb619 --- /dev/null +++ b/.changeset/wild-chicken-matter.md @@ -0,0 +1,5 @@ +--- +'gitbook': patch +--- + +Fix view transition error on Safari diff --git a/packages/gitbook/src/components/utils/ZoomImage.tsx b/packages/gitbook/src/components/utils/ZoomImage.tsx index d610e9f22..7fdcd9fea 100644 --- a/packages/gitbook/src/components/utils/ZoomImage.tsx +++ b/packages/gitbook/src/components/utils/ZoomImage.tsx @@ -281,7 +281,10 @@ function startViewTransition(callback: () => void, onEnd?: () => void) { }); } catch (error) { // Safari can throw an error if another transition is already in progress - if (error instanceof Error && error.name === 'AbortError') { + if ( + error instanceof Error && + (error.name === 'AbortError' || error.name === 'InvalidStateError') + ) { callback(); onEnd?.(); return;