Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
15f1913
Site Editor: Use permalinks instead of query args and site-editor.php…
youknowriad Nov 21, 2024
edd3075
Fix some bugs
youknowriad Nov 21, 2024
6a4cc01
Fix dashboard links
youknowriad Nov 21, 2024
937ebf0
Add basic redirection
youknowriad Nov 21, 2024
c3bff73
Add server side permanent redirects for the old urls
youknowriad Nov 21, 2024
2c0b7f7
Fix the posts dataviews
youknowriad Nov 21, 2024
3c9a42c
Small fix
youknowriad Nov 21, 2024
b811a48
Remove url rewrites
youknowriad Nov 21, 2024
5153567
Fix theme previewing
youknowriad Nov 25, 2024
bc404a3
Fix query string argument
youknowriad Nov 25, 2024
b4d15dc
switch middleware to beforeNavigate
youknowriad Nov 25, 2024
e8ec07a
Filter instead of action
youknowriad Nov 25, 2024
a3324ac
Move the code to 6.8 folder
youknowriad Nov 25, 2024
2b9d0bd
Refactor deprecations
youknowriad Nov 25, 2024
5a51c5a
Set the right path to avoid redirections
youknowriad Nov 25, 2024
b03d304
Fix e2e tests
youknowriad Nov 25, 2024
551674f
Fix hybrid themes
youknowriad Nov 25, 2024
0bce3ba
Simplify redirects
youknowriad Nov 26, 2024
29eb798
Add useLocation check
youknowriad Nov 26, 2024
ff1411c
useEvent to avoid memoization
youknowriad Nov 26, 2024
e46b7ef
Return a promise from navigate
youknowriad Nov 27, 2024
544fe66
Memoize route recognizer
youknowriad Nov 27, 2024
97a7ee7
Add a comment
youknowriad Nov 27, 2024
233fa6b
Fix e2e test
youknowriad Nov 27, 2024
7fb975e
Add backport PR
youknowriad Nov 27, 2024
2e4c03d
Remove posts redirectins
youknowriad Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Return a promise from navigate
  • Loading branch information
youknowriad committed Nov 27, 2024
commit e46b7ef62500b4d04b8a53ed8f1c80df855550eb
23 changes: 13 additions & 10 deletions packages/router/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function useHistory() {
const { pathArg, beforeNavigate } = useContext( ConfigContext );

const navigate = useEvent(
( rawPath: string, options: NavigationOptions = {} ) => {
async ( rawPath: string, options: NavigationOptions = {} ) => {
const query = getQueryArgs( rawPath );
const path = getPath( 'http://domain.com/' + rawPath ) ?? '';
const performPush = () => {
Expand Down Expand Up @@ -124,17 +124,20 @@ export function useHistory() {
! document.startViewTransition ||
! options.transition
) {
return performPush();
performPush();
}
document.documentElement.classList.add( options.transition );
// @ts-expect-error
const transition = document.startViewTransition( () =>
performPush()
);
transition.finished.finally( () => {
document.documentElement.classList.remove(
options.transition ?? ''

await new Promise< void >( ( resolve ) => {
const classname = options.transition ?? '';
document.documentElement.classList.add( classname );
// @ts-expect-error
const transition = document.startViewTransition( () =>
performPush()
);
transition.finished.finally( () => {
document.documentElement.classList.remove( classname );
resolve();
} );
} );
}
);
Expand Down