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

fix(dashboard): state fixes for dynamic assets tab #3009

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

ssjagad
Copy link
Contributor

@ssjagad ssjagad commented Sep 26, 2024

Overview

Fix for screen jumping to top when selecting dashboard model properties. To fix, removed useState call and moved selectedAsset state up to parent QueryEditor component.

In doing so found the following bugs and fixed them as well.

  • Asset Model RE keeps state of old selected asset properties after changing asset

    • fix: added clearing selected properties to useEffect of when asset changes
  • Asset Properties table does not change selection mode based on widget type

    • fix: passed in missing 'correctSelectionMode' prop into table
  • Asset Model Tab breaks if you add duplicate properties after edit/preview change

    • deduped properties in hook where we reduce properties to ids for later use

Verifying Changes

Screen.Recording.2024-09-25.at.6.37.25.PM.mov

Legal

This project is available under the Apache 2.0 License.

@ssjagad ssjagad marked this pull request as ready for review September 26, 2024 01:38
@@ -19,6 +19,7 @@ export interface AssetExplorerProps {
selectedWidgets: DashboardWidget[];
timeZone?: string;
significantDigits?: number;
correctSelectionMode: 'single' | 'multi';
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a public API update or just internal?

Copy link
Contributor Author

@ssjagad ssjagad Sep 26, 2024

Choose a reason for hiding this comment

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

This one is internal. Its the props for all the RE tables in dashboard to manage dashboard state changes (ie selected widget/clicking Add or Reset). Just forgot to add in this one to the dynamic asset tab when I was doing the RE work.

fetchAll: true,
});

const currentSelectedAsset = assetSummaries.find(
Copy link
Contributor

Choose a reason for hiding this comment

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

will assetSummaries ever be undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, but in case there is no assets retrieved, currentSelectedAsset will be undefined which has handling in the query editors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unless the query errors out

@ssjagad ssjagad force-pushed the improve-asset-model-tab branch 4 times, most recently from bbf4926 to 6eb0071 Compare September 26, 2024 20:12
@ssjagad ssjagad enabled auto-merge (rebase) September 26, 2024 20:46
@ssjagad ssjagad merged commit d60fe4e into rc Sep 26, 2024
20 checks passed
@ssjagad ssjagad deleted the improve-asset-model-tab branch September 26, 2024 21:01
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.

2 participants