diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2024-03-11 05:48:53 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2024-03-12 08:04:11 +0100 |
commit | c0042287511c6aaa3447f9ffc38a095add939a25 (patch) | |
tree | 3a1c2629299bedc8babf35a35cfad697639467e8 /src/client-runtime.ffi.mjs | |
parent | 1e6354995552ff44d1527874c36ccb7de3b45f28 (diff) | |
download | lustre-c0042287511c6aaa3447f9ffc38a095add939a25.tar.gz lustre-c0042287511c6aaa3447f9ffc38a095add939a25.zip |
:recycle: Add a 'Map' vdom node for more efficient msg mapping.
Diffstat (limited to 'src/client-runtime.ffi.mjs')
-rw-r--r-- | src/client-runtime.ffi.mjs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client-runtime.ffi.mjs b/src/client-runtime.ffi.mjs index 12c8627..ab80fbf 100644 --- a/src/client-runtime.ffi.mjs +++ b/src/client-runtime.ffi.mjs @@ -71,8 +71,12 @@ export class LustreClientApplication { const vdom = this.#view(this.#model); this.#didUpdate = false; - this.#root = morph(this.#root, vdom, (msg) => { - this.send(new Dispatch(msg)); + this.#root = morph(this.#root, vdom, (handler) => (e) => { + const result = handler(e); + + if (result.isOk()) { + this.send(new Dispatch(result[0])); + } }); } |