Skip to content

feat: Make hook viewportSubscriptionOptions in viewport hooks partial#2627

Merged
jnumainville merged 2 commits intodeephaven:mainfrom
jnumainville:21214_viewport_hook_improvements
Feb 25, 2026
Merged

feat: Make hook viewportSubscriptionOptions in viewport hooks partial#2627
jnumainville merged 2 commits intodeephaven:mainfrom
jnumainville:21214_viewport_hook_improvements

Conversation

@jnumainville
Copy link
Copy Markdown
Contributor

I'm attempting to use one of these hooks for DH-21214. I have an array column that I need to pull all the data out of, so I need to customize the viewportSubscriptionOptions. Currently these hooks require you to pass in the whole object, but I think the rows and columns should be automatically replaced if you just want to customize the other options.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the viewportSubscriptionOptions parameter partial in the viewport-related hooks (useViewportData and useSetPaddedViewportCallback), allowing users to customize subscription options without having to manually specify rows and columns, which are now automatically filled in by the hooks based on the viewport state.

Changes:

  • Changed viewportSubscriptionOptions parameter type from dh.ViewportSubscriptionOptions to Partial<dh.ViewportSubscriptionOptions> in both hooks
  • Implemented logic to automatically fill in missing rows and columns properties using nullish coalescing when creating viewport subscriptions
  • Added comprehensive test coverage for the new behavior, including scenarios with missing rows, missing columns, and missing both properties

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/jsapi-components/src/useViewportData.ts Updated type signature and documentation for viewportSubscriptionOptions parameter to accept Partial<dh.ViewportSubscriptionOptions>
packages/jsapi-components/src/useSetPaddedViewportCallback.ts Updated parameter type, ref type, and implementation to automatically fill in missing rows and columns when creating viewport subscriptions; added documentation
packages/jsapi-components/src/useSetPaddedViewportCallback.test.ts Added comprehensive test coverage for the new auto-fill behavior with three scenarios: missing rows, missing columns, and missing both

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 49.77%. Comparing base (c46fbaf) to head (6d66da9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...api-components/src/useSetPaddedViewportCallback.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2627      +/-   ##
==========================================
- Coverage   49.78%   49.77%   -0.01%     
==========================================
  Files         774      774              
  Lines       43767    43770       +3     
  Branches    11256    11258       +2     
==========================================
- Hits        21789    21788       -1     
- Misses      21960    21964       +4     
  Partials       18       18              
Flag Coverage Δ
unit 49.77% <83.33%> (-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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Looks good to me, but I want @bmingles to take a look (he wrote this hook so he's on the hook)

@mofojed mofojed requested a review from bmingles February 24, 2026 21:23
columns: table.columns,
};
viewportOptionsMissingRows = {
columns: table.columns,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor issue with this test data is that columns is the same reference that gets included as the default. Might want to differentiate.

Copy link
Copy Markdown
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

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

minor comment on test case

Copy link
Copy Markdown
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

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

Left a question about the mock proxy usage

Copy link
Copy Markdown
Contributor

@bmingles bmingles left a comment

Choose a reason for hiding this comment

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

LGTM

@jnumainville jnumainville merged commit 8a94e8d into deephaven:main Feb 25, 2026
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2026
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.

4 participants