Skip to content
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

Fix JSON values in raw editors and input-code #19608

Merged
merged 8 commits into from
Sep 8, 2023

Conversation

azrikahar
Copy link
Contributor

Currently input-code interface has the following logic to stringify JSON when the type is json or the value is object:

if (props.type === 'json' || typeof props.value === 'object') {
return JSON.stringify(props.value, null, 4);
}

However it is not accounting for a specific combination of type is json and typeof value is string, which is why string value such as {{my_operation}} is being "doubly escape quoted". Fixes #19469

The similar fix was then applied to system-raw-editor (the one used in Flows and Insights) and form-field-raw-editor. Fixes #19244

Also added a drive-by one-liner fix in form-field-raw-editor line 98 to prevent JSON.parse from breaking when trying to parse values such as {{my_operation}}.

@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2023

🦋 Changeset detected

Latest commit: ceef964

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@directus/app Patch
@directus/api Patch
directus Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@paescuj paescuj merged commit fad16a6 into main Sep 8, 2023
6 checks passed
@paescuj paescuj deleted the fix/json-in-raw-editors-and-input-code branch September 8, 2023 07:39
@github-actions github-actions bot added this to the Next Release milestone Sep 8, 2023
br-rafaelbarros pushed a commit to personal-forks/directus-source that referenced this pull request Nov 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants