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

Removed TS rule from DashViewSpec that allowed any type of additional values to be added to a DashViewSpec. #3949

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

cnrudd
Copy link
Member

@cnrudd cnrudd commented Mar 26, 2025

  • Added renderMode & refreshMode to DashViewSpec.

I discussed the existence of

    /** Additional properties to store on the DashView */
    [x: string]: any;

on DashViewSpec with @ghsolomon, and he suggested seeing what happens if that was removed. Nothing bad happened in toolbox, but it did reveal that renderMode & refreshMode could be made more "official" on the spec.

The presence of

    /** Additional properties to store on the DashView */
    [x: string]: any;

means that misspelling a key like "groupname" would not be revealed by TS.

Hoist P/R Checklist

Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.

  • Caught up with develop branch as of last change.
  • Added CHANGELOG entry, or determined not required.
  • Reviewed for breaking changes, added breaking-change label + CHANGELOG if so.
  • Updated doc comments / prop-types, or determined not required.
  • Reviewed and tested on Mobile: not required
  • Created Toolbox branch: not required

If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.

Pull request reviewers: when merging this P/R, please consider using a squash commit to
collapse multiple intermediate commits into a single commit representing the overall feature
change. This helps keep the commit log clean and easy to scan across releases. PRs containing a
single commit should be rebased when possible.

… values to be added to a DashViewSpec.

+ Added renderMode & refreshMode to DashViewSpec.
Copy link

@Copilot 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 enforces stricter type safety in DashViewSpec by removing the TS index signature that allowed arbitrary additional properties and introduces explicit renderMode and refreshMode properties.

  • Removed the catch-all index signature from DashViewSpec.
  • Added renderMode and refreshMode with appropriate types.
  • Updated the CHANGELOG to document these changes.

Reviewed Changes

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

File Description
CHANGELOG.md Updated changelog entry to reflect the removal of an overly permissive TS rule
desktop/cmp/dash/DashViewSpec.ts Removed the index signature and added explicit properties renderMode and refreshMode

@@ -53,6 +53,15 @@ export interface DashViewSpec {
/** True (default) to allow renaming the view. */
allowRename?: boolean;

/** Additional properties to store on the DashView */
[x: string]: any;
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

I’m pretty sure renderMode and refreshMode are specific to DashContainerViews (and already exist in the DashContainerViewSpec interface which extends this one):

export interface DashContainerViewSpec extends DashViewSpec {

@ghsolomon ghsolomon requested review from ghsolomon March 27, 2025 12:40
Copy link
Contributor

@ghsolomon ghsolomon left a comment

Choose a reason for hiding this comment

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

Nice cleanup! See comment re: renderMode and refreshMode being specific to DashContainerViewSpecs

@@ -3,6 +3,10 @@
## v73.0.0-SNAPSHOT - unreleased

* Support for reporting Client Version in Admin WebSockets tab.
* ⚠️ Removed TS rule from DashViewSpec that allowed any type of additional values to be added to a DashViewSpec.
The rule defeats the goal of the DashViewSpec interface, which is to help guide app developers
Copy link
Member

Choose a reason for hiding this comment

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

TMI, I think. Ok to just say "Removed Incorrect TypeScript constraint..." and let the chips fall where they may

@lbwexler lbwexler marked this pull request as draft March 27, 2025 20:10
@cnrudd
Copy link
Member Author

cnrudd commented Mar 28, 2025

@ghsolomon and I discussed this more and decided to try to turn this into a chance to use renderMode and refreshMode on DashCanvas as a way to trigger render or refresh only when a Dash Canvas View is visible on the screen -- "above the fold". More changes related to that coming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants