PricingBlog

What is the intended workflow for using API responses with context

  • lennartblmn-1479404267243569225

    lennartblmn

    1 month ago

    When I fetch data via an API on a parent component and pass it through context, the value is null in the editor — so I can't see or test how child components will look with real data. I end up using placeholder/hardcoded values to preview the UI, but then risk forgetting to remove them before going live.


    What is the recommended way to handle this?
    1479404267470196838-image.png
    1479404267998674975-image.png
    1479404268262785235-image.png
  • erikbeus-1479414759194365952

    Erik Beuschau

    1 month ago

    One option is using a Default to formula and fallback to some test values. It's not ideal though.
    We hope to introduce better test data soon, but I don't have an ETA yet 🤷‍♂️
    👍2
  • needtheanswers-1480137666640089124

    needtheanswers

    1 month ago

    I use "default to" with data from attributes, but I only set the attribute values within my data-provider-component. This way they are available within my project, but not on the actual page
    1480137666354872445-image.png
    ❤️2
  • lennartblmn-1480193806694481951

    lennartblmn

    1 month ago

    Ah that’s smart! Thank you!
  • needtheanswers-1480194149092298845

    needtheanswers

    1 month ago

    You are welcome 🙂