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: When removing and then re-adding a foreign key the selection menu doesnt show the first record #8365

Open
1 task done
IdontKnowWhatToNameThisAccount opened this issue Apr 29, 2024 · 0 comments

Comments

@IdontKnowWhatToNameThisAccount
Copy link

Please confirm if bug report does NOT exist already ?

  • I confirm there is no existing issue for this

Steps to reproduce ?

Short description: This bug needs these conditions: A one-to-many relationship where the key being refrenced needs to be autoincrement/identity. Now, when you try to change the foreign key in a specific way the first record of the primary key list disappears from the selection. This is frustrating and annoying.

Long description:

Step 1: Make SQLite database from the following query:

CREATE TABLE Countries (
ID INTEGER PRIMARY KEY AUTOINCREMENT ,
Name text
);
CREATE TABLE Cities (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
Name text,
Country_ID INTEGER,
FOREIGN KEY (Country_ID)
REFERENCES Countries (ID)
);
INSERT INTO Countries (Name)
VALUES ("Italy"), ("United States"), ("France");
INSERT INTO Cities (Name, Country_ID)
VALUES ("Washington", 2), ("New York", 2), ("Paris", 2);

This creates two tables, one called Countries and another called Cities, each with three entries. Theres a one-to-many constraint where one Country can have multiple cities. As you may notice, Paris is also assigned to USA instead of France, but this is intentional and needed for later.

  • Step 2: Add the databse as a Data Source in the NocoDB interface, then go to the table "Cities"

  • Step 3: Go to the "Fields" Menu and enable the refrenced Countries to be shown. After closing that window you should be able to see a list of cities and the countries theyre in. Paris is also assigned to the USA. grafik

All of this was just preperation, the rest is the actual way to replicate the bug.

  • Step 4: The bug appears when we want to change the assigned Country in a particular way. In the Paris record, click right next to the United States text into the empty space, not onto the text. Now a small cross will appear which allows us to remove the country from the city record. Click that cross. grafik

Step 5: Directly after removing the United States refrence from Paris, click the "+" Symbol in the empty country-field. Now two countries will be listed: USA and France. But the first record from the Countries-table, which is Italy, is missing from the selection:grafik When we close and re-open the menu, Italy re-appears and can be selected and everything works fine. Yes, I know that Paris is not in Italy and in this case I can actually select the correct fields, but in some cases I would need to re-close and then re-open the panel to assign the proper country.

This bug always affects the first record of the table being refrenced and disappears after re-entering the selection window. But I've found this to be very frustrating for my colleagues during a small trial at work. Sometimes people misklick the wrong entry and then want to correct it. This confuses non-tech-savy people a lot.

Desired Behavior

I would expect the list to display all entries right away, like this:
grafik

Project Details

NocoDB used as Docker: no, but bug appears both in the desktop standalone version and in docker.
NocoDB version: 0.205.1
Database used in NC_DB_URL: sqlite3
Project was created by clicking: Nothing
OS on which NocoDB is running: Window 10x64, Docker Linux shows the same bug

Attachments

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏌️ Open
Development

No branches or pull requests

1 participant