Skip to content

2.0.0-beta.4 onSettled async callback prevents a component from unmounting #2644

@aekobear

Description

@aekobear

Describe the bug

If an async function is passed to onSettled() the function is called correctly when the component mounts, but when the component is supposed to be unmounted, an error about "call not being a function" prevents it from unmounting.

My guess is that solid is getting the Promise as a return value from the function call and assuming it is the clean-up function. Later when it tries to call the Promise as a typical callback, it fails.

Your Example Website or App

https://solid2.netlify.app/#solidjs-repl:gIRySxz_QjKFyTW8zLCCxg

Steps to Reproduce the Bug or Issue

  1. go to https://solid2.netlify.app/#solidjs-repl:gIRySxz_QjKFyTW8zLCCxg
  2. click the [SUBMIT] button which should unmount the "unmount me!" component
  3. note the error that appears

Expected behavior

I expect async functions to be supported like they were with onMount().
If that is impossible, I expect a more explicit error to be presented when an async function is passed in so that I know what I am doing wrong and how to fix it

Screenshots or Videos

No response

Platform

  • OS: linux
  • Browser: chrome
  • Version: 146.0.7680.153

Additional context

No response

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