Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 27 commits into from
Sep 3, 2024

Conversation

AkshatJawne
Copy link
Contributor

@AkshatJawne AkshatJawne commented Aug 8, 2024

Closes #2128

@AkshatJawne AkshatJawne self-assigned this Aug 8, 2024
packages/iris-grid/src/IrisGridTreeTableModel.ts Outdated Show resolved Hide resolved
packages/iris-grid/src/IrisGridTreeTableModel.ts Outdated Show resolved Hide resolved
@AkshatJawne
Copy link
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
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

Copy link

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
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)

@@ -71,6 +71,10 @@ const IrisGridModelUpdater = React.memo(
columnHeaderGroups,
partitionConfig,
}: IrisGridModelUpdaterProps) => {
if (model.formatter !== formatter) {
Copy link
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
Copy link
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
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

@AkshatJawne
Copy link
Contributor Author

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

@AkshatJawne
Copy link
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

Copy link
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

mattrunyon
mattrunyon previously approved these changes Aug 23, 2024
mattrunyon
mattrunyon previously approved these changes Aug 23, 2024
Copy link
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
10 checks passed
@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