fable 5, useElmish rework - #713
Merged
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…tion Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
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.UseElmishlifecycle/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.Teststo 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #711
useElmishto fix some edgecases and subscription disposal Subscriptions registered are not disposed when the React component unmounts #711[<ReactLazyComponent>]Check if we can verify argument names when using[<ReactLazyComponent>]from existing component #712