Don't rename components on Cut and Paste

Default component names have an integer suffix, eg textInput42.

If the component is copied (eg by Copy/Paste) then of course a new name is required. Retool does this by updating the suffix, eg textInput43.

But if the component is simply moved by Cut/Paste there is no need to rename it by updating the suffix.

But Retool currently does update the integer suffix on Cut/Paste thus creating a new name.
This means that any references to the component will no longer work and would have to be updated by hand. In some case this can be very tedious and introduce the risk of errors.

Please do not update component names when they are moved by Cut/Paste

For more information and possible workarounds see...

1 Like

Thanks for reaching out, @davblo. I think the primary lesson here is that every Retool builder should get in the habit of naming their components semantically- as it sounds like doing so bypasses the issue entirely - but I'm just as guilty of not always doing that.

One potential issue that I foresee if we were to simply preserve the original name without any additional safeguards is the following:

  1. User selects and cuts a component or group of components.
  2. They - or a multiplayer - add a new component to the canvas with the same name.
  3. Bad things happen when they try to paste the original content back onto the canvas.

I'm not against implementing a change like this, but I think that it's actually quite nuanced. I'll talk to the team and let you know what they think. :+1: