-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Budi 9011 - DecodeId helper #15549
base: master
Are you sure you want to change the base?
Budi 9011 - DecodeId helper #15549
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Only thing that would be helpful is to add a test case or two for this into the string-templates test cases!
I would test both invalid cases (passing strings that simply are not an encoded ID, as well as properly encoded IDs).
Description
Carbon copy of
packages/backend/backend-core/src/sql.utils.ts line 125
- this PR surfaces a Handlebars Helper to allow the user to un-encode a numeric ID from an SQL table. This is useful when fetching IDs from Form Blocks.Addresses
#15428
Screenshots
When using the ID from the Form Block in the bindings, it is returned as an encoded array
%5B /* ID HERE */%5D
, but with this new helper decodeId we can extract the ID itself without any URI encoded square-brackets.{{ New Form Block.actor._id }}
{{ decodeId New Repeater Block.actor._id }}
{{ decodeURI New Repeater Block.actor._id }}
Helper also returns a comma-separated string, when passed an array of numeric IDs.
%5B1%2C2%2C3%5D
{{ decodeId "%5B1%2C2%2C3%5D" }}
{{ decodeURI "%5B1%2C2%2C3%5D" }}
Launchcontrol
Adds a decodeId helper for cleanly retrieving IDs from form-blocks