feat: DH-14630 - ACL Editor Hooks#1257
Merged
bmingles merged 54 commits intodeephaven:mainfrom May 4, 2023
Merged
Conversation
82d1f74 to
ead50c4
Compare
e099c9a to
7ce7ea0
Compare
511b47f to
21d7b82
Compare
Codecov Report
@@ Coverage Diff @@
## main #1257 +/- ##
==========================================
+ Coverage 45.57% 45.76% +0.18%
==========================================
Files 484 490 +6
Lines 34077 34202 +125
Branches 8532 8554 +22
==========================================
+ Hits 15531 15652 +121
- Misses 18495 18499 +4
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out more.
|
mofojed
requested changes
May 4, 2023
Comment on lines
+6
to
+9
| * React hook that closes a given table when the component unmounts. | ||
| * @param table | ||
| */ | ||
| export default function useTableCloseOnUnmount( |
Member
There was a problem hiding this comment.
Being pedantic, this would close the table on unmount OR if the table changes. I can't think of a better name though and don't feel too strongly about it.
| expect(TableUtils.makeFilterValue).not.toHaveBeenCalled(); | ||
| expect(viewportData.applyFiltersAndRefresh).toHaveBeenCalledWith([]); | ||
| } | ||
| ); |
Member
There was a problem hiding this comment.
I'd add another test:
it('should cancel debounce on unmount', () => {
const searchText = 'mock.searchText';
const debounceMs = 400;
const { result, unmount } = renderHook(() =>
useDebouncedViewportSearch(viewportData, 'mock.column', debounceMs)
);
result.current(searchText);
jest.advanceTimersByTime(5);
unmount();
jest.advanceTimersByTime(debounceMs);
expect(TableUtils.makeFilterValue).not.toHaveBeenCalled();
expect(viewportData.applyFiltersAndRefresh).not.toHaveBeenCalled();
});
| ): (searchText: string) => void { | ||
| return useMemo( | ||
| () => | ||
| debounce((searchText: string) => { |
Member
There was a problem hiding this comment.
We should be cancelling the debounce on unmount.
| expect(maybeTable.close).not.toHaveBeenCalled(); | ||
| } | ||
| } | ||
| ); |
Member
There was a problem hiding this comment.
Should add a case that it closes the old table if the table provided changes.
mofojed
previously approved these changes
May 4, 2023
|
|
||
| rerender(nextTable); | ||
|
|
||
| expect(table.close).toHaveBeenCalled(); |
Member
There was a problem hiding this comment.
Suggested change
| expect(table.close).toHaveBeenCalled(); | |
| expect(table.close).toHaveBeenCalled(); | |
| expect(nextTable.close).not.toHaveBeenCalled(); |
mofojed
approved these changes
May 4, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Supports enterprise DH-14630
closes #1260
BREAKING CHANGE:
generateEmptyKeyedItemsRangepreviously required a singlecountarg, but now requires astartandendindex