| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| 1.14.0 source code.tar.gz | 2026-09-11 | 1.3 MB | |
| 1.14.0 source code.zip | 2026-09-11 | 1.5 MB | |
| README.md | 2026-09-11 | 10.9 kB | |
| Totals: 3 Items | 2.8 MB | 0 | |
🍜 1.14.0
This release introduces the VContext, VProps and VModel DSL terms, along with their smart constructors vcontext, vprops and vmodel, for ambient access to the context, props and model from anywhere in a View.
It also introduces two breaking changes: the view function now takes fewer arguments (only the model), and the View type takes more type parameters (View context props model action) — View now has type parameter symmetry with Component context props model action and Effect context props model action. See the migration notes below.
✨ Special thanks
- @ners —
VContext
✨ Highlights
- Ambient accessors:
vcontext/vprops/vmodel(synonymswithContext/withProps/withModel). Any part of a view tree can read the app-globalcontext, the enclosing component'sprops, or itsmodelwithout an extra argument. They are not nodes: each wraps a function that is applied — and the wrapper discarded — when the tree is built or rendered, so they never appear in the virtual DOM the runtime diffs.propsandmodelare resolved through the type system (a mismatch is a compile error);contextagainst the app's single cell. - ⚠️
viewtakes only themodel.view :: model -> View context props model action. Readcontext/propswith the accessors instead. Migration below. - ⚠️
Viewgained apropstype parameter.View context model action→View context props model action, matchingComponent context props model action. toHtmlWith—toHtmlWith :: context -> props -> model -> View context props model action -> ByteStringrenders a component's view on the server; it supplies the values the accessors resolve against. PlaintoHtmlis for bare static markup (context/props/modelall()). ⚠️setContextis gone with it.- One
contextcell per app. TheglobalContexttop-levelIORefis gone; the app owns the cell, every component holds a reference to it, andmodifyContextis a single atomic update rather than a rewrite of every component. - Static mounts.
SomeStaticComponentnow holds theComponentitself (plus its dictionaries);mountStaticworks for components with or withoutprops(mountStaticWithPropsis a deprecated alias until 1.15). A static mount now uses itsStaticKeyas the diff key, so swappingvcomp_ (static (mountStatic A))for…Breplaces the child instead of running B'sdiffPropsagainst A. - Lifecycle hooks. New
onDestroyedWith, andonDestroyedWith/onBeforeDestroyedWithnow actually receive the element'sDOMRef(it was alwaysundefined). Miso.Lensfixes.preview/preuseno longer loop forever;_Nothingis nowPrism (Maybe a) ().- Hydration. Events raised before the vtree is mounted are dropped instead of dispatched against nothing (a startup race);
toHtmlcollapses adjacent text nodes inside fragments, across a[View], and through the ambient accessors, so the server's markup matches the client's hydration walk instead of silently falling back to a full re-render. - Native (Lynx).
svgWith_— inline SVG content that readscontext/props/modelambiently;content_takes all three ahead of the contentView. - Nix / CI. A real,
callCabal2nix-capablewasm32-wasiHaskell package set (pkgs.wasmPkgs,pkgs.wasmWebBundle;nix-build -A miso-wasm-ghc9141,sample-app-wasm-ghc9141, …) built onghc-wasm-meta, pinned toflake.lock; the WASM integration tests are nix-native;overlays.defaultis exported for downstream flakes; everything moved to GHC 9.14.1; stale GitHub Actions bumped;cabal check-clean upper bounds.
⚠️ Breaking changes & migration
1. view takes only the model. Drop the context and props arguments; a view that ignored them just loses two wildcards:
:::haskell
-- 1.13
viewModel :: () -> () -> Model -> View () Model Action
viewModel _ _ (Model x) = …
-- 1.14
viewModel :: Model -> View () () Model Action
viewModel (Model x) = …
A view that used them reads them at the point of use instead (see the snippets below). component / startApp / startAppWithContext / misoWithContext / prerenderWithContext are otherwise unchanged.
2. View has a props parameter. Insert a props variable after context in your signatures; code that leaves it polymorphic needs nothing else:
:::haskell
header :: View context model action -- 1.13
header :: View context props model action -- 1.14
Mount combinators (mount_, mountWithProps, (+>), vcomp, …) forget the child's props at the boundary exactly as they forget its model and action.
3. Server-side rendering. ToHtml (View …) and ToHtml [View …] now require context ~ (), props ~ () and model ~ () — a bare View is static markup. A component's view is rendered with toHtmlWith, which replaces the removed setContext:
:::haskell
toHtml (div_ [] [ "static markup" ]) -- bare View
toHtmlWith ctx props model (view comp model) -- a component's view
4. SomeStaticComponent. Its payload is a Component, not a props -> SomeComponent function; mountStatic now accepts components with props, mountStaticWithProps is deprecated (removed in 1.15). Call sites like vcomp_ (static (mountStatic comp)) are unchanged. On Lynx, Miso.Native.X.Element.Svg.Property.content_ takes context, props and model ahead of the content View (or use svgWith_).
5. _Nothing :: Prism (Maybe a) () (was Prism (Maybe a) a, which could never match).
📖 Using vcontext, vprops and vmodel
All three are drop-in Views: put them anywhere a node goes. The function you pass is applied when the tree is built or rendered.
:::haskell
data Theme = Light | Dark deriving Eq
data Props = Props { title :: MisoString } deriving Eq
data Model = Model { count :: Int } deriving Eq
view :: Model -> View Theme Props Model Action
view Model { count } =
div_ []
[ -- the app-global context, read where it is needed
vcontext $ \theme ->
span_ [ class_ (themeClass theme) ] [ "Counter" ]
-- the props this component was mounted with
, vprops $ \Props { title } ->
h1_ [] [ text title ]
-- the model — also available ambiently, for helpers it isn't passed to
, vmodel $ \Model { count = c } ->
span_ [] [ text (ms c) ]
, button_ [ onClick AddOne ] [ "+" ]
, text (ms count)
]
Because props and model are type parameters of View, vprops sees the props of the component whose view contains it and vmodel its model — statically. A child mounted with mountWithProps / vcomp sees its own props and model, never its parent's.
The model is still handed to view purely for convenience; view _ = withModel $ \m -> … is equivalent. Where the accessors earn their keep is a helper deep in the tree that would otherwise need the value threaded down through every call:
:::haskell
-- Themed button usable from any component in the app, no `theme` argument.
themedButton :: MisoString -> action -> View Theme props model action
themedButton label act =
withContext $ \theme ->
button_ [ class_ (buttonClass theme), onClick act ] [ text label ]
Redraw semantics are unchanged — the accessors add no redraw logic of their own:
vcontextdoes not opt a component into context-driven redraws; that is still governed byuseContext = True. It sees a freshcontextwhenever the surrounding view is rebuilt for any reason.vpropsis re-resolved when the parent passes differentprops;vmodelwhen themodelchanges afterupdate.
On the server, toHtmlWith ctx props model is what they resolve against; a vmodel nested inside a mounted child component sees that child's initial (or hydrated) model.
What's Changed
- fix:
Prismpreview/preuseinfinite loop,_Nothingmatch by @dmjio in https://github.com/dmjio/miso/pull/1632 - refactor: drop the
liveModeIORef, threadliveexplicitly by @dmjio in https://github.com/dmjio/miso/pull/1633 - fix: Drop events raised before the vtree is mounted (hydration race) by @dmjio in https://github.com/dmjio/miso/pull/1635
- fix: pass
domReftoonDestroyed/onBeforeDestroyedhooks by @dmjio in https://github.com/dmjio/miso/pull/1636 - feat: VContext by @ners in https://github.com/dmjio/miso/pull/1637
- feat:
VPropsby @dmjio in https://github.com/dmjio/miso/pull/1638 - refactor:
SomeStaticComponentholdsComponentby @dmjio in https://github.com/dmjio/miso/pull/1641 - fix: use the
StaticKeyas a static mount's diffkeyby @dmjio in https://github.com/dmjio/miso/pull/1642 - feat:
VModelby @dmjio in https://github.com/dmjio/miso/pull/1639 - fix: Drop unused
_componentEventsby @dmjio in https://github.com/dmjio/miso/pull/1644 - refactor: replace
globalContextwith one app-ownedcontextcell by @dmjio in https://github.com/dmjio/miso/pull/1643 - refactor:
viewtakes onlymodelby @dmjio in https://github.com/dmjio/miso/pull/1645 - docs: fix stale
view/ViewHaddocks andcontext/propsambient-read examples by @dmjio in https://github.com/dmjio/miso/pull/1646 - release: bump to
1.14.0.0by @dmjio in https://github.com/dmjio/miso/pull/1647 - flake: expose
overlays.defaultby @dmjio in https://github.com/dmjio/miso/pull/1648 - ci: bump stale GitHub Actions versions, drop dead security opt-in by @dmjio in https://github.com/dmjio/miso/pull/1651
- nix:
wasm32-wasiHaskell package set viaghc-wasm-metaby @dmjio in https://github.com/dmjio/miso/pull/1650 - nix: fix deprecated
pkgs.systeminwasm32-wasipackage set by @dmjio in https://github.com/dmjio/miso/pull/1653 - fix: pre-release regressions found reviewing 1.13.0 -> 1.14.0.0 by @dmjio in https://github.com/dmjio/miso/pull/1654
- ci: pin ghc-wasm-meta to flake.lock everywhere by @dmjio in https://github.com/dmjio/miso/pull/1655
- docs: title the CHANGELOG section for 1.14.0.0 by @dmjio in https://github.com/dmjio/miso/pull/1656
- chore: add upper bounds for ghcjs-base, ghcjs-prim and ghc-experimental by @dmjio in https://github.com/dmjio/miso/pull/1657
Full Changelog: https://github.com/dmjio/miso/compare/1.13.0...1.14.0