Skip to content

LitLabs.motion.animate() throws an error #53

@leolorenzoluis

Description

@leolorenzoluis

The prototype that I have was working when Lit root is using non Elmish (basically similar to switching the two here) https://github.com/fable-compiler/Fable.Lit/blob/main/sample/App.fs#L47

Now when I load a LitComponent with Elmish I get the following error on the console:

animate.ts:195 Uncaught TypeError: Cannot read properties of undefined (reading 'addController')
    at Animate.update (animate.ts:195:18)
    at Animate._$resolve (directive.ts:134:17)
    at resolveDirective (lit-html.ts:1120:24)
    at ElementPart._$setValue (lit-html.ts:2077:5)
    at TemplateInstance._update (lit-html.ts:1224:16)
    at ChildPart._commitTemplateResult (lit-html.ts:1566:16)
    at ChildPart._$setValue (lit-html.ts:1418:12)
    at classExpr.setValue (async-directive.ts:366:19)
    at classExpr.requestUpdate (Hook.fs:338:9)
    at HookContext.setState (Hook.fs:148:17)

I had the following TemplateResult

    html $"""
    <div class="{className} {transition.className}" {LitLabs.motion.animate()}>
        <div>
            <p>{item.Id} {item.FriendlyName} {item.URL}</p>
            <sl-button @click={Ev (fun _ -> transition.triggerLeave())}>Delete monitor</sl-button>
            <sl-button @click={Ev (fun _ -> EditMonitor item |> dispatch)}>Edit monitor</sl-button>
        </div>
    </div>
    """

Removing the {LitLabs.motion.animate()} removes the error and it still animates, but not sure if I might have hide done something I'm not aware of.

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