Conversation
severo
left a comment
There was a problem hiding this comment.
hmmm, it becomes a bit complex, but why not if it's the only way.
In any case, can we move the code to useColumnWidths?
severo
left a comment
There was a problem hiding this comment.
sorry it's complex, and there are no comments, I have a hard time understanding the code; And do you have a video to show the issue and how it is solved by this PR?
| }) | ||
| }, [allColumnsParameters, isHiddenColumn]) | ||
|
|
||
| const visibleColumnIndexes = useMemo(() => { |
There was a problem hiding this comment.
nit, but for consistency,
| const visibleColumnIndexes = useMemo(() => { | |
| const columnIndexes = useMemo(() => { |
| useEffect(() => { | ||
| if (availableScrollerWidth === undefined) return | ||
| setScrollNeedInputs?.({ columnIndexes: visibleColumnIndexes, availableWidth: availableScrollerWidth, waitMs: 50 }) | ||
| }, [availableScrollerWidth, visibleColumnIndexes, setScrollNeedInputs]) |
There was a problem hiding this comment.
Iiuc, no need for a useEffect: see below
| setAvailableWidth?.(tableWidth - leftColumnWidth) | ||
| const available = tableWidth - leftColumnWidth | ||
| setAvailableWidth?.(available) | ||
| setAvailableScrollerWidth(available) |
There was a problem hiding this comment.
I understand that we don't need the useEffect above, but:
| setAvailableScrollerWidth(available) | |
| setScrollNeedInputs?.({ columnIndexes: visibleColumnIndexes, availableWidth: available, waitMs: 50 }) |
There was a problem hiding this comment.
and remove the availableScrollerWidth state
There was a problem hiding this comment.
and if so, I guess that we could have only one function call that replaces the lines
|
This is getting too complicated, and is trying to a fix a problem we probably don't need to worry about, I have a simpler and better explained PR here: #308 |
I didn't add a lot of description to #300 but what I was attempting to fix was the behavior where the scrollbar would erratically appear as the table was resizing above the minimum column widths, and would sometimes stay visible in certain positions where it shouldn't when columns are still above their minimum widths and there is actually no horizontal overflow to scroll through.
That PR fixed the scrollbar issue but created a visible gap on the left of the table. I wanted a css-only solution but I have a simple js solution that should fix all the problems. We just determine what the minimum width of the full table will be based on the minimum width of each column, and if the table-scroll div width is ever greater than that we hide the scrollbar.