Function text inputs truncated for no reason

Hello!

I have experienced a bit of frustration recently with function code being lost or overwritten when trying to modify other areas of code. I don't have a current active example that I can reliably reproduce, but this issue often manifests as URL parameter values suddenly being cutoff (often near quoted/string objects and equal signs) but more recently entire clauses of code were lost after moving to a function from a JS Node:

image

This was an equality comparison for some minor branching logic so it is not hard to recreate, however code going missing on its own is never good. This is eerily similar to a previous issue I have reported where parameter names were being fully changed in my code block : Function Parameter Input Replaces JS Code

I'm not sure if this is related to linting or other code helpers, but I'd really enjoy it if I could disable "helpers" from Retool in certain places since they really just end up in the way or doing things I don't intend.

2 Likes

I saw this post and thought it was a weird bug, but just now, while adding functionality to a workflow that has been used for a long time, I had the exact same thing happen.

image

There was a decent amount of code after that = and I can't actually quickly/easily re-create it. Hopefully someone at Retool can figure out what's going on here.

Adding a note for others, if the code was in a previously deployed release, you can at least go back and preview an old release and copy/paste the code out of an old one, back into the current working version. Not ideal, but better than nothing.

Just click the deploy history button, and then the ... menu on an old release, and choose preview.

image
image

3 Likes

This is how I've been doing restoration as well. My main fear is if I don't notice the truncation and then deploy standard updates -- then get errors in runtime and don't know when the truncation happened. I have become extra paranoid with the run/deploy/retest cycle and it is making me not want to us functions or any sidebar content in a workflow. I have never seen this happening in JS node (at least I don't remember this being an issue until moving to functions).

I've had this happen before as well and share your frustration.

FWIW I always have VS Code open and when I'm doing something in Retool I don't want to lose, I have a version of it in VS Code. Copy/paste is a bit of a clunky workaround but it has saved me a good amount fo time.

This just happened to me again after editing the settings on a function and re-deploying, I started getting failed run notifications because the function was mostly missing. So... bump

1 Like

Hi folks!

Apologies about this issue, this sounds incredibly frustrating and is not the experience we want for developers on Retool.

I just pinged an engineer who just last Tuesday made a PR to adds validation to saves, so hopefully he can help triage this and pinpoint what we can do to fix this.

I am super curious on if the save requests going out from the browser are missing the code snippets that are following the = :thinking:

If this does happen again, definitely check the save request from the console inspector and if you are on cloud we can use the x-request-id to look in at the payload and see if the change is not being properly reflected in the data getting sent to the cloud.

Thanks for chiming in @Jack_T!

I'll do my best to grab the last save request data, but usually this seems to happen without me needing to save/deploy the workflow. Might have something to do with how many queries/functions I have open at the time and then switching between them causes issues? I can't really reproduce the issue so it is a bit of a constant state of alertness I need to have.

1 Like

@pyrrho No problem,

Wish I could do more to help :sweat: this is a very fickle issue.

Interesting theory about the number of queries/functions open in your workflow that you are toggling between :thinking:

Just to confirm, this is in workflows and does this only occur within 'Function' blocks or has it happened in query blocks or in apps at all?

Got in touch with our workflows eng team on this, they also want to confirm that no one has multiple tabs open.

I know that all of you are experienced Retool builders and know that the save functionality can get the app out of sync if there are more than one browser tab open with the app editor but we just want to officially rule that out so we can dig deeper into what could be causing this :sweat_smile:

The engineers were also asking to get their hands on y'alls apps to do some testing. Anyone who can share their apps and use export app from the debugger that would be very useful to pass along to them!

Hey @Jack_T, thanks for the continued input!

Wanted to say that I have never seen this in an app -- only in a workflow. It also seems to still be related to functions. As part of this thread, I just went to go get the workflow JSON and checked on my functions and lo and behold, the SAME function has truncated the SAME bit of code:

I did not do anything but open this workflow (which I haven't touched since the last deployment) and check on the functions to see which one your engineers should focus on.

Now I have an undeployed workflow which has had code removed (and I only know about it because I am paying attention).

This is bad. I don't know if it is only functions in workflow, but it is very unreliable and not conducive to continued use of the workflow product.

Here is the code which was truncated but I can recover by going back to the last deployed version:

I can promise you I didn't go into another window and delete 40 lines of code and forget that I did it.

ETA: Again, this happened at a '=' character but not the first instance of one -- perhaps the first instance of a '==' though (in my case it is actually '===' but if it is something to do with paired characters this is the first bit of code that has them)

I caught it in the wild and was able to reproduce for a video:

Truncated Code Issue

All I did was click through the functions. The code was truncated.

I don't believe this has anything to do with open windows.

ETA: or if it does, it has nothing to do with me. When I click on other functions they opened in a new tab. Except for the mapResults function. It stayed open, and then when I clicked back to it the code was truncated.

ETA2: It is even juicier. I don't even have to switch back to the function from the list, I can just close the newly opened tab and the code is truncated again.

2 Likes

Thank you for the screen recording and additional details @pyrrho!!!

I agree this is crazy, I have never seen anything like this before in Retool.

I just sent your last two comments over to one of our workflows engineers and this is a major priority for us to get to the bottom of this and fix it ASAP.

On the side note of tabs, what I meant was that ~maybe~ you had a deeply buried retool tab open that had was sending in /save requests to the Retool server and 'resetting' the progress. But that doesn't seem to be the case, as this seems to be somehow related to the = symbol :face_with_monocle:

Did you manage to get the export JSON of the app for our engineers to dig into?

INTEG-0009_Update Stratus Status from BCX.json (79.5 KB)

here ya go!

1 Like

Thanks again for sharing that @pyrrho,

Still waiting to hear back from the engineer on the workflows team on this.

Will hopefully have some updates soon :crossed_fingers:

1 Like