Skip to content

Conversation

pol-rivero
Copy link

This PR fixes 2 bugs related to the "reference view" (open the "References" tab and click a referenced or dependent table to view the table below).


1. (Fix) Incorrect spacing in the header. The master fk had a space between the left bracket and the name.

Old:
image

New:
image


2. (Workaround) Updates were not propagated properly in nested references.
Suppose that table_1 depends on table_2, and table_2 depends on table_3. If I open table_1 and from there I click on table_2 to open the reference view, it works perfectly and it updates in real time (clicking on a table_1 row shows only the related rows in table_2). However, if I now click on table_3 from table_2, the rows shown in table_3 are not quite updated in real time and seem to lag behind by 1 click.

Below is a video demonstrating this issue. I created 2 mysql tables like this:

CREATE TABLE table_1 (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(250)
);

INSERT INTO table_1 (id, name) VALUES 
(1, 'aaa'),
(2, 'bbb'),
(3, 'ccc'),
(4, 'ddd'),
(5, 'eee'),
(6, 'fff');

CREATE TABLE table_2 (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(250),
  table_1_fk INT,
  CONSTRAINT fk_table_1_2 FOREIGN KEY (table_1_fk) REFERENCES table_1 (id)
);

INSERT INTO table_2 (id, name, table_1_fk) VALUES 
(10, 'a', 1),
(20, 'b', 2),
(30, 'c', 3),
(40, 'd', 4),
(50, 'e', 5),
(60, 'f', 6);

And then I opened many nested references like this: table_1 -> table_2 -> table_1 -> table_2 -> ... -> table_2
When I click row 2 (bbb), the behavior I would expect is that the selected row is propagated down the chain, until all tables show the 'b' row.

In this video, you can see how it is not being propagated properly:

old.mp4

And here it is working properly in this PR:

1000ms.mp4

However, I'm not entirely happy with my solution and I don't really know why it works. It seems that previously GridCache.refreshTime was being set to new Date().getTime(), and adding some milliseconds to that time make it work properly. I chose 1000ms because that seemed to work fine on my machine.

In the second video, there is some flickering while the results are fetched, but I suppose that's normal because of the number of chained fetches. I made another test with only 3 references (which is closer to real world usage), and the fetching is basically instantaneous with very little flickering.

This is a workaround instead of a proper fix. Feel free to make the changes you see fit, now that you know how to reproduce the issue.

... = master [ fk_name]  <- Old
... = master [fk_name]  <- New
@pol-rivero pol-rivero force-pushed the fix-nested-reference-view branch from 7e37b11 to 60cca83 Compare March 14, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant