Pricing Blog

Do workflows not function by context in API events?

  • luca.heck-1430560079794409584

    Luca Heck

    1 month ago

    I'm really desperate to figure out why this isn't working:

    I'm using a modified Spark One dialog component. I've enabled the handleCloseClick workflow in the context via the sc-dialog-root provider. This allows me to close the dialog in a controlled manner via an individual event. Otherwise, it always closes automatically when you click on a button.

    Now, handleCloseClick works perfectly as long as it is not integrated into an API.
    My plan: When the user has submitted the contact form via API, handleCloseClick should be executed if successful.

    As soon as I integrate handleCloseClick into an API event, it no longer works... why?
    1430560080100851833-Xnip2025-10-22_16-13-54.jpg
    1430560080914415869-Xnip2025-10-22_16-11-42.jpg
  • lennartblmn-1430578010318180352

    lennartblmn

    1 month ago

    Does your api actually return a success response?
  • luca.heck-1430581472376655902

    Luca Heck

    1 month ago

    Of course. I also tried it with a sleep of 2000 ms—the workflow works there.
  • plusmin-1430772887207415851

    Armand

    1 month ago

    You could use the open attribute and the onOpenChange event to manually control the open state.

    https://spark-pro.dev/spark-one/dialog

    My hunch as to why it is not working with the onSuccess event is that it only works with a direct onClick event - when using the Spark Core package - and the onSuccess is not a direct onClick event.
  • Tod-1430772888516034631

    Tod

    1 month ago

    Great job @Armand! Your contribution to the Nordcraft Community just made you advance to Community Level 14! 🌲