From 6a0c2871adfa24c3b2083239262df8c2073f60b6 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sat, 28 Sep 2019 23:25:53 +0200 Subject: [PATCH] added an experimental avoidDomDiffing API; refs #121 --- karax/karax.nim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/karax/karax.nim b/karax/karax.nim index 4ebb855..dffa98b 100644 --- a/karax/karax.nim +++ b/karax/karax.nim @@ -595,6 +595,14 @@ proc runDiff*(kxi: KaraxInstance; oldNode, newNode: VNode) = var onhashChange {.importc: "window.onhashchange".}: proc() var hashPart {.importc: "window.location.hash".}: cstring +proc avoidDomDiffing*(kxi: KaraxInstance = kxi) = + ## enforce a full redraw for the next redraw operation. + ## This can be used as a temporary way to workaround DOM diffing + ## problems or to avoid the DOM diffing when you already know + ## it should use a completely new DOM. + ## This is an experimental API. + kxi.currentTree = nil + proc dodraw(kxi: KaraxInstance) = if kxi.renderer.isNil: return let rdata = RouterData(hashPart: hashPart)