-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add JSONparseSafe helper #235
feat: Add JSONparseSafe helper #235
Conversation
cc @bigcommerce/dev-docs |
Seems fine to me - @jairo-bc WDYT? @RomanKrasinskyi it occurs to me from your description that perhaps the existing If we had such a thing, you could also do something like:
I have no problem with also creating this new helper, I just think we should fix the safety on the old one also. :) |
Created a ticket to implement these changes. See DEVDOCS-4750. |
@bookernath In your suggestion we will parse json twice: once in condition and another one inside {{#if}} block. It look strange. |
🎉 This PR is included in version 5.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What? Why?
We have the JSONParse helper which parse JSON and return an object:
Helper works fine until non-json comes to parse. In this case it will break a page because it always expects syntactically correct JSON.
We faced with such case when parameter can be string or json and need to have a helper that can parse it safely.
According to required, we want to add a new
JSONparseSafe
helper:So, the helper try to parse passed parameter then
If you need more information please reach me
How was it tested?
Tested manually / Unit tests
cc @bigcommerce/storefront-team