-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
After adding a foreign key constraint the record summary for linked cells doesn't display correctly #4237
Comments
@seancolsen I've updated this issue and thought I'd tell you since you expressed curiosity. |
Thanks @zackkrida. Good find! I was able to reproduce this too. I'll add some repro steps based on our sample data:
Note EDIT: The steps above are now out-of-date. See updated steps below Here's why this is happening:
Given that we're already refreshing the constraints, I would imagine this should be pretty easy to fix. We need to dig into the code, find the place where the constraints are being refreshed, and also refresh the records. This is probably a one or two line fix. As such, I'm labeling this "good first issue". |
Hey, I'd like to take a shot at this issue. |
Sure, feel free to submit a PR, @atleehlavinka |
I wasn't able to replicate this issue. I used the Library Management sample dataset and followed the replication steps given above. Here's the video where I try to replicate the issue: |
I recreated the data as shown in the video. The cause of this issue seems to be that the data is being linked via a column that is not the PK (notice that the link occurs with 'original_id' and not 'id'). When I link the 'favorite_food' column to the PK in the Food table, no refresh is required. When I link the same column to a non-PK field that is unique, I have to press the Refresh button. |
@atleehlavinka Thanks for the video. Yep, you certainly took all the steps to reproduce it! I promise I was able to reproduce it with exactly these steps before. I suspect there is some nondeterminism at play here due to JavaScript garbage collection. Here are some modified repro steps:
Screencast_20250211_072755.webmRefreshing the whole page avoids any GC issues. Would you care to have another go at this using the steps above? |
Thanks Sean! I can reliably reproduce this now. I'll see what I can do. |
…eign key constraint (Fixes mathesar-foundation#4237)
This solved the issue on my end, I followed the steps to recreate the issue and it solves it after adding that snippet. |
After adding a foreign key constraint to an existing column which references another table, the column with the constraint has the styling of a 'linked record' applied but still only shows the ID of the record rather than the linked table's record summary.
I think this is most simply explained via this quick video:
Screencast.From.2025-02-06.10-05-56.mp4
The text was updated successfully, but these errors were encountered: