[ci] format
This commit is contained in:
parent
bd5aa1cd35
commit
a8b979ef40
2 changed files with 67 additions and 66 deletions
|
@ -48,7 +48,7 @@ const announce = () => {
|
||||||
|
|
||||||
const PERSIST_ATTR = 'data-astro-transition-persist';
|
const PERSIST_ATTR = 'data-astro-transition-persist';
|
||||||
|
|
||||||
let parser: DOMParser
|
let parser: DOMParser;
|
||||||
|
|
||||||
// The History API does not tell you if navigation is forward or back, so
|
// The History API does not tell you if navigation is forward or back, so
|
||||||
// you can figure it using an index. On pushState the index is incremented so you
|
// you can figure it using an index. On pushState the index is incremented so you
|
||||||
|
@ -347,7 +347,7 @@ async function transition(
|
||||||
toLocation = new URL(response.redirected);
|
toLocation = new URL(response.redirected);
|
||||||
}
|
}
|
||||||
|
|
||||||
parser ??= new DOMParser()
|
parser ??= new DOMParser();
|
||||||
|
|
||||||
const newDocument = parser.parseFromString(response.html, response.mediaType);
|
const newDocument = parser.parseFromString(response.html, response.mediaType);
|
||||||
// The next line might look like a hack,
|
// The next line might look like a hack,
|
||||||
|
@ -388,12 +388,13 @@ async function transition(
|
||||||
let navigateOnServerWarned = false;
|
let navigateOnServerWarned = false;
|
||||||
|
|
||||||
export function navigate(href: string, options?: Options) {
|
export function navigate(href: string, options?: Options) {
|
||||||
|
|
||||||
if (inBrowser === false) {
|
if (inBrowser === false) {
|
||||||
if (!navigateOnServerWarned) {
|
if (!navigateOnServerWarned) {
|
||||||
// instantiate an error for the stacktrace to show to user.
|
// instantiate an error for the stacktrace to show to user.
|
||||||
const warning = new Error("The view transtions client API was called during a server side render. This may be unintentional as the navigate() function is expected to be called in response to user interactions. Please make sure that your usage is correct.");
|
const warning = new Error(
|
||||||
warning.name = "Warning";
|
'The view transtions client API was called during a server side render. This may be unintentional as the navigate() function is expected to be called in response to user interactions. Please make sure that your usage is correct.'
|
||||||
|
);
|
||||||
|
warning.name = 'Warning';
|
||||||
console.warn(warning);
|
console.warn(warning);
|
||||||
navigateOnServerWarned = true;
|
navigateOnServerWarned = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue