Skip to content

Commit

Permalink
Vine update to version 2.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mateussouzaweb committed Jun 5, 2022
1 parent e7c8fc6 commit 4bd82d4
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/scripts/vine.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*! Vine JS (2.0.6) - https://github.com/mateussouzaweb/vine */
/*! Vine JS (2.0.7) - https://github.com/mateussouzaweb/vine */

declare global {
interface Window {
Vine: {}
}
}

export const __version = '2.0.6'
export const __version = '2.0.7'
/**
* Represents an element that can be selectable
*/
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4bd82d4

Please sign in to comment.