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