Fix nested reference view #1074
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:

New:

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:
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 tonew 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.