From 3deef9ebcc27412ef11ca69156c25c5fa252b876 Mon Sep 17 00:00:00 2001 From: Makin Date: Wed, 18 Jun 2025 19:25:16 +0200 Subject: prevent validation from running multiple times --- src/html.js | 9 +++++++++ src/write/build-modes/static-build.js | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/html.js b/src/html.js index 71b6f4d5..097ecfee 100644 --- a/src/html.js +++ b/src/html.js @@ -53,6 +53,11 @@ export const attributeSpec = { }, }; +// Validation keeps running even after we validate +// all of data, this let us turn it off and let build run free +let VALIDATION_DISABLED = false; +export function finishValidation() { VALIDATION_DISABLED = true; } + // Pass to tag() as an attributes key to make tag() return a 8lank tag if the // provided content is empty. Useful for when you'll only 8e showing an element // according to the presence of content that would 8elong there. @@ -1773,6 +1778,10 @@ export class Template { } static validateSlotValueAgainstDescription(value, description) { + if (VALIDATION_DISABLED) { + return true; + } + if (value === undefined) { throw new TypeError(`Specify value as null or don't specify at all`); } diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js index b5ded04c..1683c729 100644 --- a/src/write/build-modes/static-build.js +++ b/src/write/build-modes/static-build.js @@ -233,6 +233,8 @@ export async function go({ return false; } + html.finishValidation(); + /* await progressPromiseAll(`Writing data files shared across languages.`, queue( dataWrites.map(({path, data}) => () => { -- cgit 1.3.0-6-gf8a5