Skip to content

Commit a45abd8

Browse files
committed
perf(router): minimize viewtransition css
1 parent f6d7570 commit a45abd8

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

packages/qwik-router/src/runtime/src/qwik-router-component.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ import { loadClientData } from './use-endpoint';
7474
import { useQwikRouterEnv } from './use-functions';
7575
import { createLoaderSignal, isSameOrigin, isSamePath, toUrl } from './utils';
7676
import { startViewTransition } from './view-transition';
77+
import transitionCss from './view-transition.css?inline';
7778

7879
/**
7980
* @deprecated Use `QWIK_ROUTER_SCROLLER` instead (will be removed in V3)
@@ -121,18 +122,7 @@ const internalState = { navCount: 0 };
121122
* This hook should be used once, at the root of your application.
122123
*/
123124
export const useQwikRouter = (props?: QwikRouterProps) => {
124-
useStyles$(`
125-
@layer qwik {
126-
@supports selector(html:active-view-transition-type(type)) {
127-
html:active-view-transition-type(qwik-navigation) {
128-
:root{view-transition-name:none}
129-
}
130-
}
131-
@supports not selector(html:active-view-transition-type(type)) {
132-
:root{view-transition-name:none}
133-
}
134-
}
135-
`);
125+
useStyles$(transitionCss);
136126
const env = useQwikRouterEnv();
137127
if (!env?.params) {
138128
throw new Error(
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@layer qwik {
2+
@supports selector(html:active-view-transition-type(type)) {
3+
html:active-view-transition-type(qwik-navigation) {
4+
:root {
5+
view-transition-name: none;
6+
}
7+
}
8+
}
9+
@supports not selector(html:active-view-transition-type(type)) {
10+
:root {
11+
view-transition-name: none;
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)