front/SvelteViewEngine: add isSsr local
This commit is contained in:
parent
c606379bcd
commit
9674fc87dd
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
let countdown;
|
let countdown;
|
||||||
let validUntilDate = new Date(validUntil);
|
let validUntilDate = new Date(validUntil);
|
||||||
$: countdown = $locals.isPreRender ? '...' : Time.humanizeTimeTo(validUntilDate);
|
$: countdown = $locals.isSsr ? '...' : Time.humanizeTimeTo(validUntilDate);
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
|
@ -48,12 +48,14 @@ export default class SvelteViewEngine extends ViewEngine {
|
|||||||
const rootTemplateFile = await this.resolveFileFromCanonicalNameOrFail('templates/svelte_template.html');
|
const rootTemplateFile = await this.resolveFileFromCanonicalNameOrFail('templates/svelte_template.html');
|
||||||
const rawOutput = await this.fileCache.get(rootTemplateFile, !config.get<boolean>('view.cache'));
|
const rawOutput = await this.fileCache.get(rootTemplateFile, !config.get<boolean>('view.cache'));
|
||||||
|
|
||||||
|
locals.isSsr = true;
|
||||||
const {
|
const {
|
||||||
head,
|
head,
|
||||||
html,
|
html,
|
||||||
css,
|
css,
|
||||||
} = await this.renderSvelteSsr(canonicalViewName, locals);
|
} = await this.renderSvelteSsr(canonicalViewName, locals);
|
||||||
|
|
||||||
|
locals.isSsr = false;
|
||||||
const serializedLocals = JSON.stringify(locals, (key, value) => {
|
const serializedLocals = JSON.stringify(locals, (key, value) => {
|
||||||
if (key.startsWith('_') || typeof value === 'function') return undefined;
|
if (key.startsWith('_') || typeof value === 'function') return undefined;
|
||||||
return value;
|
return value;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="render-mode">{$locals.isPreRender ? 'SSR' : 'CSR'}</div>
|
<div class="render-mode">{$locals.isSsr ? 'SSR' : 'CSR'}</div>
|
||||||
|
|
||||||
<div class="data-table-container">
|
<div class="data-table-container">
|
||||||
<table class="data-table">
|
<table class="data-table">
|
||||||
|
Loading…
Reference in New Issue
Block a user