aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2023-04-28 15:17:56 +0100
committerHayleigh Thompson <me@hayleigh.dev>2023-04-28 15:17:56 +0100
commit6d314230346336ba5b452b1df39b908ffa666f45 (patch)
tree73a9a90ab92c56fbed5afeba90349946c1f6ec96
parent10bc93f41efdd9aab25e1e0d29b02b3b961158c5 (diff)
downloadlustre-3.0.0-rc.2.tar.gz
lustre-3.0.0-rc.2.zip
:bookmark: v3.0.0-rc.23.0.0-rc.2
-rw-r--r--gleam.toml2
-rw-r--r--src/lustre.ffi.mjs17
2 files changed, 11 insertions, 8 deletions
diff --git a/gleam.toml b/gleam.toml
index d658676..d044e12 100644
--- a/gleam.toml
+++ b/gleam.toml
@@ -1,5 +1,5 @@
name = "lustre"
-version = "3.0.0-rc.1"
+version = "3.0.0-rc.2"
target = "javascript"
diff --git a/src/lustre.ffi.mjs b/src/lustre.ffi.mjs
index 4713750..b39db16 100644
--- a/src/lustre.ffi.mjs
+++ b/src/lustre.ffi.mjs
@@ -43,13 +43,16 @@ export const mount = (app, selector) => {
// bit of state to track whether we need to run the cmds we have or
// not.
const [shouldRunCmds, setShouldRunCmds] = React.useState(true);
- const [[state, cmds], dispatch] = React.useReducer((state, msg) => {
- // Every time we call the user's update function we'll get back a
- // new lot of cmds to run, so we need to set this flag to true to
- // let our `useEffect` know it can run them!
- setShouldRunCmds(true);
- return app.update(state, msg);
- }, app.init);
+ const [[state, cmds], dispatch] = React.useReducer(
+ ([state, _], msg) => {
+ // Every time we call the user's update function we'll get back a
+ // new lot of cmds to run, so we need to set this flag to true to
+ // let our `useEffect` know it can run them!
+ setShouldRunCmds(true);
+ return app.update(state, msg);
+ },
+ app.init
+ );
React.useImperativeHandle(ref, () => dispatch, [dispatch]);
React.useEffect(() => {