-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
This is how FunctionComponent.Of
caches passed function:
// Cache the render function to prevent recreating the component every time when FunctionComponent.Of
// is called inside another function (including generic values: let MyCom<'T> = ...)
let cacheKey = __callingSourceFile.Value + "#L" + (string __callingSourceLine.Value)
I have a reusable piece of code that uses FunctionComponent.Of
for different cases and they result in the same cacheKey. So it picks a wrong function at runtime for all cases but one.
At least the displayName
should also be part of the cacheKey (I pass a custom value anyway) or accept optional custom cacheKey (although that would reveal its implementation).
None of the options is available which keeps me pinned to Fable.React 5.4.0 (last version before function caching was intorduced)
Metadata
Metadata
Assignees
Labels
No labels