Home App Docs Github

State is not updated for symbols

I have a symbol where I fetch some data depending on the user input and then set it on the state. I then use the state to populate some text fields. However, sometimes the text fields aren’t getting populated for some reason even though I can see that the data exists on state.

I’m not sure if this could have something to do with the page, because it works sometimes, and sometimes not which is unfortunate.

Hi @kevva! Thanks for reaching out.

Can you send the link to the Builder page this is occurring on? I’d be happy to take a look :grin:

Hey @maddy, I PM:ed you with the page.

1 Like

Hi! While we’re looking into this for you, would you mind sending over the code for any custom components you’ve used? Thanks!

After investigating, it appears that for products that have no sku, those products aren’t passing the condition state.product.sku and that’s why you’re seeing undefined.

@kara, but even for those with an SKU, the state isn’t set. If I log when I fetch the data inside the symbol, I can see it being fetched. However, maybe it’s because some of them are nested or something? I.e there’s a product price symbol inside another product price symbol.

Also, when I look at a page in Builder, some of the data is fetched (on the client though), but since we’re using AMP we need it to be fetched on the server which I think the custom JS should do, right?

Could be related to Running Custom Javascript SSR doesn't seem to work.

If you want an example I can PM you the pages.

Just to follow-up, I noticed the undefined has been resolved in the editor. What changes did you make on your end?

As for the AMP page, if you could send me the page, that would be helpful. Thanks!

@kara the changes we did was to run the functions again manually. Seems like custom functions are not running in SSR as Kevin pointed out in his previous comment.