Skip to content

FunctionComponent.Of with generics doesn't call memoizeWith #162

Open
@leolorenzoluis

Description

@leolorenzoluis

Given I have the following code

let test<'T> =
  FunctionComponent.Of((fun (props: {|Dispatch: Msg -> unit; test: 'T|}) ->
        log props.test
        span [] []
          ]), memoizeWith= fun o n -> log "haha"; false)

// Use somewhere in the code say at the root component
test({|Dispatch=dispatch; test: 5|})

The memoizeWith callback is not called, and for some reason the function keeps getting called infinitely.

If I change it to a non generic then it works fine

let test =
  FunctionComponent.Of((fun (props: {|Dispatch: Msg -> unit; test: int|}) ->
        log props.test
        span [] []
          ]), memoizeWith= fun o n -> log "haha"; false)

// Use somewhere in the code say at the root component
test({|Dispatch=dispatch; test: 5|})

Not sure if this is an issue with Fable or React.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions