From 4bd82d43e04fba7bdf3c00c86d725d6fe3280948 Mon Sep 17 00:00:00 2001 From: Mateus Souza Date: Sat, 4 Jun 2022 22:42:13 -0300 Subject: [PATCH] Vine update to version 2.0.7 --- src/scripts/vine.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/scripts/vine.ts b/src/scripts/vine.ts index 89a64c9..e39d018 100644 --- a/src/scripts/vine.ts +++ b/src/scripts/vine.ts @@ -1,4 +1,4 @@ -/*! Vine JS (2.0.6) - https://github.com/mateussouzaweb/vine */ +/*! Vine JS (2.0.7) - https://github.com/mateussouzaweb/vine */ declare global { interface Window { @@ -6,7 +6,7 @@ declare global { } } -export const __version = '2.0.6' +export const __version = '2.0.7' /** * Represents an element that can be selectable */ @@ -484,15 +484,17 @@ async function render(component: Component, callback: Callback) { return } - if (result !== current) { + // If has no real change, then just run render callback + if (result === current) { + await callback(component) + return + } - // Destroy existing child elements - await destroy(component.element) + // Destroy existing child elements + await destroy(component.element) - // Mount new HTML result - component.element.innerHTML = result - - } + // Mount new HTML result + component.element.innerHTML = result // Render callback await callback(component) @@ -538,6 +540,9 @@ async function mount(target: HTMLElement | Document) { continue } + // Attach placeholder while mounting + element.__components[namespace] = null + // Solve the state result // State as function avoid pointer reference on objects const state = await solveResult(definition.state)