update for 5.5.0-beta-1#48
Merged
Merged
Conversation
Member
|
The code is looking good to me, and I tested it locally and it is working. I just have one question which I asked in the original PR. |
Member
Author
|
Added root caching and related unit-tests. |
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.
Update Fable.Elmish.React to 5.5.0-beta-1
Package update (via
dotnet paket update)Fable.Elmish.Reactupdated from5.0to5.5.0-beta-1>= 5 prereleasewhich resolves to the new versionSource code —
src/common.fsComponent<LazyProps,LazyState>withshouldComponentUpdate) — v5.5 replaced this withReact.memoopen Elmish.React.Internal(no longer needed; old package didn't have this module, new one has it but only forupdateInputValue)LazyProps,LazyState, andComponents.LazyViewtypeslazyView*functions usingReact.memowithemitJsExpr/emitJsStatement(matching the upstream pattern)hmrCountin memo props — whenwindow.Elmish_HMR_Countchanges, the comparison returnsfalseand forces a re-renderlazyView2WithandlazyView3Withnow take 2 args and return a function (matching v5.5's calling convention used bywithReactBatchedUsingetc.)#else(release) branches updated to match new upstream signaturesNew unit tests (14 added, 33 total)
withKeytests (8 tests in LazyViewTests.fs) — ported from theelmish/reactrepo, exercisingwithKeythrough HMR's memo wrappers:withKey "my-key"on alazyView2Withelement sets.keylazyViewWithlazyView3WithwithKeyworks on non-memo elements too.keyisNonewithoutwithKeywithKeydoesn't change the component type (no remount)Root caching tests (6 tests in ProgramTests.fs) — verify the HMR fix that caches React roots across hot reloads:
RootCache.getOrCreateRootreturns the sameIReactRootinstance on repeated callsuseEffectmount counter) proves mount count stays at 1 across 3 model changeslazyView2Withpartial application + cached root = same root instance, no remount