Skip to content

feat: Make rollup group behaviour a setting in the global settings menu#2183

Merged
AkshatJawne merged 27 commits intodeephaven:mainfrom
AkshatJawne:2128_rollup_settings
Sep 3, 2024
Merged

feat: Make rollup group behaviour a setting in the global settings menu#2183
AkshatJawne merged 27 commits intodeephaven:mainfrom
AkshatJawne:2128_rollup_settings

Conversation

@AkshatJawne
Copy link
Copy Markdown
Contributor

@AkshatJawne AkshatJawne commented Aug 8, 2024

Closes #2128

@AkshatJawne AkshatJawne self-assigned this Aug 8, 2024
Comment thread packages/iris-grid/src/IrisGridTreeTableModel.ts Outdated
Comment thread packages/iris-grid/src/IrisGridTreeTableModel.ts Outdated
@AkshatJawne
Copy link
Copy Markdown
Contributor Author

@mofojed I tried experimenting with trying to have the IrisGridModelUpdater listen for the COLUMNS_CHANGED event, and then accordingly set the modelColumns in the event handler, but that was not working (it also effectively does the same hack, if it were to work, where we set to the model.columns anyways).

I am going to push the "hacky" code that we discussed yesterday, and then we can continue the conversation on finding a cleaner way to do this.

Copy link
Copy Markdown
Contributor Author

@AkshatJawne AkshatJawne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will investigate unit test failures

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 63.47826% with 42 lines in your changes missing coverage. Please review.

Project coverage is 46.64%. Comparing base (336e1f3) to head (f10645a).

Files Patch % Lines
packages/iris-grid/src/IrisGridTreeTableModel.ts 24.24% 25 Missing ⚠️
packages/iris-grid/src/IrisGridModelUpdater.tsx 84.84% 10 Missing ⚠️
...e-studio/src/settings/FormattingSectionContent.tsx 16.66% 5 Missing ⚠️
packages/iris-grid/src/IrisGrid.tsx 66.66% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #2183    +/-   ##
========================================
  Coverage   46.64%   46.64%            
========================================
  Files         692      693     +1     
  Lines       38571    38606    +35     
  Branches     9647     9839   +192     
========================================
+ Hits        17992    18009    +17     
+ Misses      20568    20544    -24     
- Partials       11       53    +42     
Flag Coverage Δ
unit 46.64% <63.47%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AkshatJawne
Copy link
Copy Markdown
Contributor Author

For the image mismatches, will need to have new images taken, to replace the rollup-rows-and-aggregate-columns images, where the group column is shown by default (given that the setting will be activated by default)

columnHeaderGroups,
partitionConfig,
}: IrisGridModelUpdaterProps) => {
if (model.formatter !== formatter) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the "less" hacky way to fix this is to get rid of all the useEffects in here. Those run after the render, when really all we want from this component is to set values when they have changed. And then make sure it checks on every render (i.e. the component shouldn't be memoized at the top), and then we don't need to pass in a modelColumns prop. Instead could make a hook to run immediately when something has changed, e.g.

function useOnChange(callback: () => void, deps: DependencyList): void {
  // Want to call the callback if the deps have changed from the previous time
  const prevDeps = usePrevious(deps);
  if (prevDeps === undefined || !deps.every((dep, i) => dep === prevDeps[i])) {
    callback();
  }
}

Then instead of useEffect in IrisGridModelUpdater, just use useOnChange, and use model.columns instead of modelColumns, get rid of the modelColumns prop, and don't wrap the function in React.memo. I think that will work.

@AkshatJawne AkshatJawne marked this pull request as ready for review August 15, 2024 20:20
@AkshatJawne AkshatJawne requested a review from mofojed August 15, 2024 20:20
@AkshatJawne
Copy link
Copy Markdown
Contributor Author

AkshatJawne commented Aug 15, 2024

@mofojed Adjusted logic according to your review, e2e tests may still fail because of the rollup images. How can we update those?

@mofojed
Copy link
Copy Markdown
Member

mofojed commented Aug 15, 2024

@AkshatJawne Run npm run e2e:update-ci-snapshots to update the snapshots: https://github.com/deephaven/web-client-ui/blob/main/README.md#e2e-tests

Comment thread packages/iris-grid/src/IrisGridModelUpdater.tsx Outdated
@AkshatJawne
Copy link
Copy Markdown
Contributor Author

@mofojed Ran command, appears the snapshots were not updated?

@AkshatJawne AkshatJawne requested a review from mofojed August 15, 2024 21:57
@AkshatJawne
Copy link
Copy Markdown
Contributor Author

Screenshot 2024-08-16 at 10 26 03 AM

Tried running npm run clean then npm i, and then also restarted my computer and TS server, keep getting the above

Comment thread packages/iris-grid/src/IrisGridTreeTableModel.ts Outdated
@AkshatJawne AkshatJawne requested a review from mofojed August 19, 2024 20:16
Copy link
Copy Markdown
Contributor Author

@AkshatJawne AkshatJawne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for re-review @mofojed @mattrunyon

Comment thread packages/iris-grid/src/IrisGridModelUpdater.tsx
Comment thread packages/iris-grid/src/IrisGridModelUpdater.tsx
Comment thread packages/react-hooks/src/useOnChange.ts
@AkshatJawne AkshatJawne requested a review from mattrunyon August 22, 2024 19:51
Comment thread packages/iris-grid/src/IrisGridModelUpdater.tsx Outdated
@AkshatJawne AkshatJawne requested a review from mattrunyon August 22, 2024 20:27
mattrunyon
mattrunyon previously approved these changes Aug 23, 2024
@AkshatJawne AkshatJawne requested a review from mattrunyon August 23, 2024 21:16
mattrunyon
mattrunyon previously approved these changes Aug 23, 2024
Comment thread packages/iris-grid/src/IrisGridTreeTableModel.test.ts Outdated
Copy link
Copy Markdown
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix test case

@AkshatJawne AkshatJawne merged commit bc8d5f2 into deephaven:main Sep 3, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make rollup group behaviour a setting in the global settings menu

3 participants