Closed GeorchW closed 1 year ago
So, here's what I think what the issue is:
The exception is thrown in the Table component. In there, the column widths are stored in the columnExtensions
variable, which is initialized from the results when rendering for the first time (l. 50), then updated via a useEffect
hook whenever the no. of columns changes (l. 204-206).
However, I suspect that the component re-renders before the effect is executed, such that it tries rendering with the old set of columns again. Then, the new column is missing.
This could be fixed by using a useMemo
hook instead of the useState
+ useEffect
combination. It would however require to split the columnExtensions
variable into two, one that carries the filtering predicate and another that carries the width.
There is another related issue: if a column changes its name, the same error occurs. You can try by running SELECT 1 AS a;
, then SELECT 1 AS b;
.
Describe the bug
When the number of columns changes and I reuse the tab, I get this error:
To Reproduce Steps to reproduce the behavior:
sqltools.results.reuseTabs
toconnection
.Complete error message below.
Expected behavior Well, a table with two columns.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
I absolutely love this extension! But when using the
reuseTabs
setting, I'm constantly getting this error. I think it's not very hard to fix, will post a comment below.