PricingBlog

Efficiently pass data

  • lennartblmn-1474353879763124247

    lennartblmn

    21 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
  • andreasmoller-1475028604927606824

    Andreas Møller

    19 days ago

    You can use a workflow event
  • lennartblmn-1475059327575523428

    lennartblmn

    19 days ago

    can you elaborate? do you mean the workflow callbacks?
  • andreasmoller-1475088227286384640

    Andreas Møller

    19 days ago

    Yes 🙂

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