Custom Javascript seems to only run on the client side.
See original GitHub issueI’m trying to run some custom javascript from within my symbol component. It works fine when I run on the client but as soon as I set the conditional the state.product
is not populated.
I have an input field of type map
on my symbol.
The code looks like this, is there something I’m missing?
async function main() {
if (Builder.isServer || Builder.isEditing) {
await fetch('/api/product?sku=LEATHER_PURSE')
.then(res => res.json())
.then(data => {
state.product = data;
});
}
}
export default main();
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Use browser to run custom JavaScript on page (client side) to ...
Another option is currently AFAIK, Chrome only. You can collect whatever information you need and build a large file from it, then use...
Read more >Client Side JavaScript does not run at all
Solved: Hello everyone, I'm looking for some help with client side scripting using javascript. I've been stuck on this for a couple of...
Read more >Running Custom Javascript SSR doesn't seem to work
I'm trying to run some custom JS from within my symbol in SSR mode but can't seem to get it to work. I...
Read more >Q: How to execute code client-side only · Issue #2473 - GitHub
I have a callback route in my application that receives access token from auth process in URL hash fragment. I'd like to parse...
Read more >Handling common JavaScript problems - MDN Web Docs
js ' when we called it in the code above). When it has loaded, we run the function we specified as the second...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mrkoreye seems to work fine now yes!
Did the fix we made a few weeks ago work for you? Just following up to make sure we resolved this issue.