Efficiently pass data

  • lennartblmn

    5 days ago

    I want to have a single drawer component at the app root, opened/closed via context from any page. That part works fine.

    My question is about passing data back to the component that triggered the open. Example: the clients page opens an "add client" drawer. The form submits, the backend returns the new client object, and I want to append it to the clients list — without a full reload.

    What's the recommended pattern for this in Nordcraft?

    I've been looking at createPromise / resolvePromise on window — the clients page creates a promise when it opens the drawer, the form resolves it with the API response, and the clients page awaits it to get the data back. It works but feels clunky.

    Is there a cleaner built-in way to handle this kind of trigger → async result → back to trigger flow?

    I also saw that workflow callbacks are a feature flag, but I'm not sure if that would solve my issue.


    Thank you for your help!
    1
  • Andreas Møller

    4 days ago

    You can use a workflow event
  • lennartblmn

    3 days ago

    can you elaborate? do you mean the workflow callbacks?
  • Andreas Møller

    3 days ago

    Yes 🙂

    as long as the async action happens in the same scope it will work

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code — but accessible to your entire team!

Try toddle — it's free!

© Copyright 2024 toddle. All rights reserved.