Skip to content

fable 5, useElmish rework - #713

Merged
Freymaurer merged 13 commits into
mainfrom
v3.4.0
May 12, 2026
Merged

fable 5, useElmish rework#713
Freymaurer merged 13 commits into
mainfrom
v3.4.0

Conversation

@Freymaurer

@Freymaurer Freymaurer commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Closes #711

@Freymaurer Freymaurer changed the title verify fable 5 compatibility fable 5, useElmish rework Apr 29, 2026
@Freymaurer
Freymaurer requested a review from Copilot May 12, 2026 13:49
@Freymaurer
Freymaurer marked this pull request as ready for review May 12, 2026 13:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Feliz for Fable 5, refactors React.useElmish to address unmount/StrictMode edge cases (notably subscription disposal), and enhances [<ReactLazyComponent>] to validate import-by-reference argument names at transpile time. It also adds a new .NET-based transpilation test project and updates templates/tooling for Fable 5.

Changes:

  • Refactor Feliz.UseElmish lifecycle/subscription handling and add extensive regression tests for unmount/StrictMode/in-flight commands.
  • Add transpile-time validation for [<ReactLazyComponent>] import-by-reference wrappers to prevent prop-name mismatches.
  • Add Transpile.Tests to validate Fable transpilation success/failure patterns and update template/tooling to Fable 5.

Reviewed changes

Copilot reviewed 70 out of 71 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/vitest.config.ts Adds Vitest tag configuration for categorized tests.
tests/Transpile.Tests/TranspileUtils.fs New helper utilities for generating/transpiling snippet projects in tests.
tests/Transpile.Tests/TranspileFailure.test.fs Adds transpilation-failure diagnostics test coverage.
tests/Transpile.Tests/Transpile.Tests.fsproj New .NET test project for transpilation validation.
tests/Transpile.Tests/README.md Documents how the transpilation tests work and how to run them.
tests/Transpile.Tests/ReactLazyComponentTests/ReactLazyImportByRefSuccess.test.fs Adds transpile-success cases for import-by-reference lazy arg-name matching.
tests/Transpile.Tests/ReactLazyComponentTests/ReactLazyImportByRefFailure.test.fs Adds transpile-failure cases for lazy wrapper arg-name mismatch diagnostics.
tests/Transpile.Tests/ReactLazyComponentTests/ReactLazyImportByRef.SharedFixtures.fs Shared fixtures for lazy import-by-reference transpile tests.
tests/Transpile.Tests/ReactLazyComponentTests/ReactLazyComponentSuccess.test.fs Ensures docs-style ReactLazyComponent example transpiles and emits expected output.
tests/Transpile.Tests/ParallelIsolation.test.fs Validates concurrent transpilation isolation.
tests/Transpile.Tests/packages.lock.json Locks packages for the new transpilation test project.
tests/Transpile.Tests/Main.fs Adds Expecto entrypoint for the transpilation test assembly.
tests/Transpile.Tests/JSXHtmlTranspile.test.fs Adds JSX output-shape transpilation assertions.
tests/Globals/Test.Globals.fsproj Includes new shared Promise test helpers in Globals tests.
tests/Globals/PromiseTest.fs Adds deterministic promise/deferred helpers for lifecycle tests.
tests/Globals/Library.fs Extends test globals helpers (tagged describes, message-aware expects).
tests/Feliz/ReactBindings/ReactLazyComponent/Wrappers/ByReference.fs Adds wrapper components for import-by-reference lazy loading tests.
tests/Feliz/ReactBindings/ReactLazyComponent/Wrappers/ByPath.fs Adds wrapper components for path-based lazy loading tests.
tests/Feliz/ReactBindings/ReactLazyComponent/Sources/TupledSource.fs Adds tupled source component fixture for lazy loading tests.
tests/Feliz/ReactBindings/ReactLazyComponent/Sources/RecordClassSource.fs Adds record/class payload source fixture for lazy loading tests.
tests/Feliz/ReactBindings/ReactLazyComponent/Sources/CurriedSource.fs Adds curried source component fixture for lazy loading tests.
tests/Feliz/ReactBindings/ReactLazyComponent/Sources/AnonRecordSource.fs Adds anonymous-record payload source fixture for lazy loading tests.
tests/Feliz/ReactBindings/ReactLazyComponent/Loading.test.fs Adds runtime loading tests for ReactLazyComponent wrappers.
tests/Feliz/ReactBindings/ReactLazyComponent/InputArgs.test.fs Adds runtime argument-forwarding tests for ReactLazyComponent wrappers.
tests/Feliz/ReactBindings/ReactLazyComponent/Fixtures/Models.fs Adds shared model payload fixtures for lazy loading tests.
tests/Feliz/ReactBindings/ReactLazyComponent/Fixtures/LazyLoadWrapper.fs Adds a shared suspense/loading harness for lazy loading tests.
tests/Feliz/Feliz.Tests.fsproj Registers new ReactLazyComponent test fixtures/suites in Feliz tests.
tests/Feliz.UseElmish/UseElmish/Unmount/InFlightPerform.test.fs Adds regression test for ignoring in-flight perform results after unmount.
tests/Feliz.UseElmish/UseElmish/Unmount/InFlightEitherError.test.fs Adds regression test for ignoring in-flight error path after unmount.
tests/Feliz.UseElmish/UseElmish/Subscription/DynamicIdsDiff.test.fs Adds regression test ensuring subscription diffing disposes only removed subs.
tests/Feliz.UseElmish/UseElmish/Subscription/DependencySwap.test.fs Adds regression test for dependency-driven resubscribe behavior.
tests/Feliz.UseElmish/UseElmish/StrictMode/ToggleSubscriptionStress.test.fs Adds stress test for StrictMode mount/unmount cycles and cleanup.
tests/Feliz.UseElmish/UseElmish/StrictMode/InitCmdOfEffect.test.fs Adds regression test that init Cmd.ofEffect fires exactly once in StrictMode.
tests/Feliz.UseElmish/UseElmish/StrictMode/InFlightPromiseIsolation.test.fs Adds regression test preventing StrictMode “ghost” promise side effects.
tests/Feliz.UseElmish/UseElmish/OnError/ProgramOverloadAmbiguity.test.fs Adds regression test for Program overload error handler routing.
tests/Feliz.UseElmish/UseElmish/ModelDisposable/Transition.test.fs Tests disposal behavior when model transitions to an IDisposable case.
tests/Feliz.UseElmish/UseElmish/ModelDisposable/PostUnmountDispatch.test.fs Tests disposal idempotency when dispatch happens after unmount.
tests/Feliz.UseElmish/UseElmish/Disposal/SubscriptionThrowDoesNotBlockCleanup.test.fs Tests that one failing subscription dispose doesn’t block other cleanup.
tests/Feliz.UseElmish/UseElmish/DispatchStability/DispatchRef.test.fs Ensures the dispatch reference stays stable across parent rerenders.
tests/Feliz.UseElmish/UseElmish/DependencyStable/ParentRerenderInitCmd.test.fs Ensures stable deps don’t replay init commands on parent rerenders.
tests/Feliz.UseElmish/UseElmish/DependencyChange/ReinitOnce.test.fs Ensures dependency changes reinit exactly once for the new instance.
tests/Feliz.UseElmish/UseElmish/DependencyChange/OldPromiseIsolation.test.fs Ensures old instance promise completion doesn’t affect new instance.
tests/Feliz.UseElmish/SubscriptionCleanup.test.fs Adds direct regression test for subscription disposal on unmount (#711).
tests/Feliz.UseElmish/Subscription.test.fs Reformats/updates subscription test code style and behavior assertions.
tests/Feliz.UseElmish/package.json Updates transpile script to clear output before running tests.
tests/Feliz.UseElmish/Main.test.fs Updates main useElmish tests and formatting/module naming.
tests/Feliz.UseElmish/Feliz.UseElmish.Tests.fsproj Adds new UseElmish regression test files to the project.
tests/Feliz.UseElmish/CmdOfPromise.test.fs Adds tests for Cmd.OfPromise behavior.
tests/Feliz.UseElmish/CmdOfEffect.test.fs Adds tests for Cmd.ofEffect behavior.
tests/Feliz.Delay/Main.test.fs Wraps a delay in RTL.act to align with React testing expectations.
src/Vitest/Library.fs Adds TestOptions.tags and formatting adjustments.
src/Feliz/CHANGELOG.md Adds changelog entry for the ReactLazyComponent arg-name validation.
src/Feliz.UseElmish/UseElmish.fs Refactors core hook logic to ensure cleanup/disposal correctness.
src/Feliz.UseElmish/Fable.Elmish.CoreLogic.md Adds reference documentation for Elmish core loop semantics.
src/Feliz.UseElmish/CHANGELOG.md Adds changelog entry describing the refactor and #711 fix.
src/Feliz.Template/Content/.config/dotnet-tools.json Updates template tool versions (Fable 5, Fantomas).
src/Feliz.CompilerPlugins/ReactComponent.fs Adds lazy import-by-ref arg-name verification at transpile time (#712).
src/Feliz.CompilerPlugins/CHANGELOG.md Adds changelog entry for the new lazy component check.
playground/src/UseElmishExample.fs Adds a playground repro/example for subscription cleanup behavior.
playground/src/packages.lock.json Updates playground lockfile to include Feliz.UseElmish project dependency.
playground/src/Main.fs Updates playground app entry rendering.
playground/src/Components.fs Updates playground UI and adds a LazyCounter example.
playground/src/CodeSplitting.fs Expands code splitting component examples (tupled/curried/record).
playground/src/App.fsproj Adds new source file and references Feliz.UseElmish in the playground.
Feliz.sln Adds the new Transpile.Tests project to the solution.
docs/versioned_docs/version-2.9.0/ecosystem/03_Hooks/Feliz.UseElmish.mdx Clarifies dependency comparison semantics for useElmish.
docs/docs/ecosystem/04_Hooks/Feliz.UseElmish.mdx Clarifies dependency comparison semantics for useElmish.
.vscode/settings.json Adds Tailwind + file exclude + F# formatting settings for dev workflow.
.gitignore Ignores tests/Transpile.Tests/temp/ generated workspaces.
.editorconfig Tweaks F# formatting rules and includes .fsx in F# settings.
.config/dotnet-tools.json Updates repo tool versions to Fable 5.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/vitest.config.ts Outdated
Comment thread tests/Globals/Library.fs
Comment thread tests/Transpile.Tests/JSXHtmlTranspile.test.fs
Comment thread src/Feliz.UseElmish/UseElmish.fs Outdated
Comment thread src/Feliz.CompilerPlugins/ReactComponent.fs Outdated
Comment thread src/Feliz.CompilerPlugins/ReactComponent.fs Outdated
Comment thread tests/Feliz.UseElmish/CmdOfPromise.test.fs
Comment thread tests/Feliz.UseElmish/CmdOfEffect.test.fs Outdated
@Freymaurer
Freymaurer merged commit 8c42e2d into main May 12, 2026
2 checks passed
@Freymaurer
Freymaurer deleted the v3.4.0 branch May 18, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subscriptions registered are not disposed when the React component unmounts

2 participants