rowyio / rowy

Low-code backend platform. Manage database on spreadsheet-like UI and build cloud functions workflows in JS/TS, all in your browser.
http://rowy.io
Other
5.94k stars 478 forks source link

Table name textbox UI error fix #1412

Closed AnushDeokar closed 10 months ago

AnushDeokar commented 1 year ago

closes #1409 It was watching the wrong field i.e. collection due to which the watchvalue will always be equal to the collection name. Also, I have added consistency in the startCase through which if you switch your input focus and comeback again on tablename field the startCase consistency would be maintained.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Updated (UTC) | | :--- | :----- | :------ | :------ | | **rowy-typedoc** | ⬜️ Ignored ([Inspect](https://vercel.com/rowy/rowy-typedoc/61aQp6tnWSRnEA9HyvCvpzy5nvr3)) | [Visit Preview](https://rowy-typedoc-git-fork-anushdeokar-fix-tablename-tex-3d4d41-rowy.vercel.app) | Sep 13, 2023 8:11pm |
vercel[bot] commented 1 year ago

@AnushDeokar is attempting to deploy a commit to the Rowy Team on Vercel.

A member of the Team first needs to authorize it.

harinij commented 12 months ago

@AnushDeokar the watchvalue is collection as the table name defaults to the collection name with case corrected form if nothing else is mentioned. The bug here is that the Text box was not editable on first attempt however is editable after another field like description is edited.

AnushDeokar commented 12 months ago

Hey @harinij, The reason why we are not able to change the table name in the first attempt is because in the first attempt onChange(startCase(watchedValue)); is triggered and since the watchValue is set to collection name doing changes in the field is causing it to reset it to collection name. Therefore the tablename field seems to be uneditable in the first attempt.

However, when we switch field to some other field and comback(let's name it as second attempt) to edit the tablename it works because this time onChange((value.trim()); is triggered which works as expected.

Another reason why keeping watchfield equal to collection does not seems to be logical because consider the following case:

  1. My table name is initially set to let's say Members which is equal to collection name.
  2. Now, I want to change my table name to students. I somehow manages to do by changing it the second attempt and I save it.
  3. However After saving I realise that I had made a typo mistake I forgot to put an 's' in the end and it's just student. Now I will again go back to table settings and as soon as I try to add an 's' at the end in the table name field(displayed as student) It will get refreshed to 'Members' which is equal to the collection name and again the table name will become uneditable since it's the first attempt. This does not makes sense since I want to start edit from student itself. This is another issue.

Changing the collection name to 'name' will fix this bug. Changes made in this PR works perfectly fine and as expected. Please let me know if I am wrong at any point or If you want to this bug to be fixed in any other way.

AnushDeokar commented 12 months ago

Why did I add a startcase in value.trim()?

Now let's say I am also able to edit the table name in the first attempt. Another change I made is changing onChange(value.trim()) to onChange(startCase(value.trim())) because in the first attempt when I am trying to change the name the case correction is done but when you switch your focus to description and again comback to change tablename the case correction will not be performed. You ofcourse cannot notice it right now in the deployment because it's not able to change the tablename in the first attempt.