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

[Bug]: Action fails when params have EOF characters inside them #8802

Closed
1 task done
rishabhrathod01 opened this issue Oct 25, 2021 · 7 comments · Fixed by #9293
Closed
1 task done

[Bug]: Action fails when params have EOF characters inside them #8802

rishabhrathod01 opened this issue Oct 25, 2021 · 7 comments · Fixed by #9293
Assignees
Labels
Bug Something isn't working FE Coders Pod Issues related to users writing javascript in appsmith High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage

Comments

@rishabhrathod01
Copy link
Contributor

rishabhrathod01 commented Oct 25, 2021

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

LOOM DEMO

Original Binding : "((currentItem) => { navigateTo(currentItem.PRODUCTS_ID, {},'NEW_WINDOW')})(JSON.parse('{"PRODUCTS_ID":"https://snipinternet.my.salesforce.com/0011Q00002PAJShQAP                ","PRODUCTS_NAME":"https://snipinternet.my.salesforce.com/5001Q00001GgPuHQAV","PRODUCTS_DESC":"a\nb\nc","PRODUCTS_COST":"","PRODUCTS_STOCK":"","PRODUCTS_CATEGORY":"","rowIndex":"0"}'))"

When a value has \n in that case JSON.parse seems to fail which in the end cause navigateTo to fail.

Steps To Reproduce

This is a sheet link that has demo data where it is reproducible. https://docs.google.com/spreadsheets/d/1uRnnqyi44h3qtndthbIAMrPsMB6Mm25tVGu-u0sRess/edit?usp=sharing

  1. Add a List Widget
  2. Connect Data in which one of the value containes \n
  3. Add a button to list widget template
  4. Add onClick {{navigateTo(currentItem.SOME_KEY, {},'NEW_WINDOW')}}
  5. See the error

Environment

Production

Version

Cloud

@rishabhrathod01 rishabhrathod01 added Bug Something isn't working Needs Triaging Needs attention from maintainers to triage labels Oct 25, 2021
@rishabhrathod01 rishabhrathod01 added FE Coders Pod Issues related to users writing javascript in appsmith Actions Pod labels Oct 25, 2021
@Nikhil-Nandagopal Nikhil-Nandagopal added High This issue blocks a user from building or impacts a lot of users JS Evaluation Issues related to JS evaluation on the platform labels Oct 26, 2021
@Nikhil-Nandagopal
Copy link
Contributor

verify if this is already solved with unescape

@rishabhrathod01
Copy link
Contributor Author

@rishabhrathod01
Copy link
Contributor Author

This issue is still present after unescape, verified both in release and production.

@rishabhrathod01 rishabhrathod01 changed the title [Bug]: navigateTo on trigger error SyntaxError: Invalid or unexpected token [Bug]: Action fails when params have \n inside them Nov 17, 2021
@rishabhrathod01 rishabhrathod01 changed the title [Bug]: Action fails when params have \n inside them [Bug]: Action fails when params have EOF characters inside them Nov 17, 2021
@rishabhrathod01 rishabhrathod01 added BE Coders Pod Issues related to users writing code to fetch and update data and removed FE Coders Pod Issues related to users writing javascript in appsmith labels Nov 17, 2021
@github-actions github-actions bot added the FE Coders Pod Issues related to users writing javascript in appsmith label Nov 18, 2021
@rishabhrathod01 rishabhrathod01 removed JS Evaluation Issues related to JS evaluation on the platform FE Coders Pod Issues related to users writing javascript in appsmith labels Nov 18, 2021
@nidhi-nair
Copy link
Contributor

This use case requires smart substitution to be turned on since the input text needs to be escaped for the new lines to be used in the request. We do need an improvement in UX for users to be told when smart substitution is the solve for a problem, but I'll be closing this issue and we can tackle that separately.

@Nikhil-Nandagopal
Copy link
Contributor

@nidhi-nair smart substitution is only for the request right? Here it seems the response is not escaped

@nidhi-nair
Copy link
Contributor

IIUC, the repro for this was to run the update query with the reference from the update form widgets. The text field contains a \n that was causing the update query to fail. @Rishabh-Rathod was there something other than this that I am missing?

@Nikhil-Nandagopal
Copy link
Contributor

@nidhi-nair no, the sheet has the \n in the PRODUCTS_ID column and that is returned to the list widget. The button is bound to currentItem.PRODUCTS_ID

@rishabhrathod01 rishabhrathod01 self-assigned this Nov 18, 2021
@rishabhrathod01 rishabhrathod01 added FE Coders Pod Issues related to users writing javascript in appsmith and removed BE Coders Pod Issues related to users writing code to fetch and update data labels Nov 18, 2021
@rishabhrathod01 rishabhrathod01 linked a pull request Nov 23, 2021 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working FE Coders Pod Issues related to users writing javascript in appsmith High This issue blocks a user from building or impacts a lot of users Needs Triaging Needs attention from maintainers to triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants