-
Notifications
You must be signed in to change notification settings - Fork 16.5k
chore(frontend): migrate non-dashboard JS/JSX files to TypeScript #37107
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
base: master
Are you sure you want to change the base?
Conversation
Migrates 15 core JavaScript/JSX files and 11 test files to TypeScript as part of the ongoing frontend modernization effort. Files migrated: - src/utils/common.js → common.ts - src/middleware/loggerMiddleware.js → loggerMiddleware.ts - src/visualizations/presets/MainPreset.js → MainPreset.ts - src/features/reports/ReportModal/actions.js → actions.ts - src/features/reports/ReportModal/reducer.js → reducer.ts - src/explore/exploreUtils/index.js → index.ts - src/explore/reducers/exploreReducer.js → exploreReducer.ts - src/explore/components/EmbedCodeContent.jsx → EmbedCodeContent.tsx - src/explore/components/ExploreChartHeader/index.jsx → index.tsx - src/explore/components/ExploreViewContainer/index.jsx → index.tsx - src/explore/components/useExploreAdditionalActionsMenu/index.jsx → index.tsx - src/components/Chart/chartAction.js → chartAction.ts - src/components/Chart/ChartRenderer.jsx → ChartRenderer.tsx - src/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx → DatasourceEditor.tsx - src/components/Datasource/utils/index.js → index.ts Key improvements: - Added proper TypeScript interfaces for all components and functions - Replaced PropTypes with TypeScript interfaces - Added typed Redux actions and state interfaces - Zero `any` types used throughout Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review Agent Run #55969a
Actionable Suggestions - 5
-
superset-frontend/src/features/reports/ReportModal/reducer.ts - 1
- Type mismatch in report filtering · Line 55-58
-
superset-frontend/src/features/reports/ReportModal/actions.ts - 4
- Potential Runtime Error · Line 148-148
- Missing Error Handling · Line 167-175
- Missing Error Handling · Line 184-193
- Success Feedback on Failure · Line 229-235
Additional Suggestions - 3
-
superset-frontend/src/components/Chart/chartAction.ts - 1
-
Incorrect Timezone Handling in Data Age · Line 774-778The data_age logging mixes local time with UTC, which may produce incorrect age values in non-UTC timezones. Consider using UTC for both dates in the diff calculation.
Code suggestion
@@ -775,1 +775,1 @@ - ? extendedDayjs(new Date()).diff( + ? extendedDayjs.utc(new Date()).diff(
-
-
superset-frontend/src/features/reports/ReportModal/actions.ts - 2
-
Inaccurate Error Message · Line 124-124The error message specifies 'dashboard' but fetchUISpecificReport is used for both dashboard and chart reports, leading to misleading feedback.
Code suggestion
@@ -120,9 +120,9 @@ - .catch(() => { - dispatch( - addDangerToast( - t( - 'There was an issue fetching reports attached to this dashboard.', - ), - ), - ); - }); + .catch(() => { + dispatch( - addDangerToast( - t( - 'There was an issue fetching reports.', - ), - ), - ); - });
-
Grammar Error in Message · Line 207-207The error message uses incorrect grammar; 'active' should be 'activate' to properly indicate the failure to activate or deactivate.
Code suggestion
@@ -204,7 +204,7 @@ - .catch(() => { - dispatch( - addDangerToast( - t('We were unable to active or deactivate this report.'), - ), - ); - }) + .catch(() => { + dispatch( - addDangerToast( - t('We were unable to activate or deactivate this report.'), - ), - ); - })
-
Review Details
-
Files reviewed - 8 · Commit Range:
c1b3085..c1b3085- superset-frontend/src/components/Chart/chartAction.js
- superset-frontend/src/components/Chart/chartAction.ts
- superset-frontend/src/explore/reducers/exploreReducer.js
- superset-frontend/src/explore/reducers/exploreReducer.ts
- superset-frontend/src/features/reports/ReportModal/actions.js
- superset-frontend/src/features/reports/ReportModal/actions.ts
- superset-frontend/src/features/reports/ReportModal/reducer.js
- superset-frontend/src/features/reports/ReportModal/reducer.ts
-
Files skipped - 0
-
Tools
- Eslint (Linter) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
Move DELETE_REPORT dispatch and success toast from .finally() to .then() so they only execute on successful deletion, not on failure. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Use vizType (derived from currentFormData) instead of formData.viz_type so drill-to-detail props are correctly enabled/disabled when the user changes visualization type without re-running the query. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ask is absent Ensures custom setDataMask handlers work in non-dashboard/embedded contexts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This comment was marked as outdated.
This comment was marked as outdated.
- common.ts: wrap return in Boolean() for proper boolean type - logger.test.ts: add dispatch property to MockStore interface - exploreReducer.ts: use flexible ExtendedControlState interface, fix SliceUpdatedAction owners type - ReportModal/actions.ts: use ThunkDispatch for thunk actions, add error handling to addReport - ReportModal/reducer.ts: cast through unknown for dynamic property access Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review Agent Run #706562
Actionable Suggestions - 1
-
superset-frontend/src/explore/reducers/exploreReducer.ts - 1
- Type mismatch in action interface · Line 147-147
Additional Suggestions - 1
-
superset-frontend/src/explore/reducers/exploreReducer.ts - 1
-
Reduced type safety in control state · Line 178-178Changing ExtendedControlState from extending ControlState to a loose Record reduces type safety, as it no longer guarantees the required properties of ControlState. The reducer casts ExtendedControlState to ControlStateMapping, which expects ControlState objects, potentially allowing invalid control configurations.
-
Review Details
-
Files reviewed - 8 · Commit Range:
2230728..234c958- superset-frontend/src/components/Chart/chartAction.js
- superset-frontend/src/components/Chart/chartAction.ts
- superset-frontend/src/explore/reducers/exploreReducer.js
- superset-frontend/src/explore/reducers/exploreReducer.ts
- superset-frontend/src/features/reports/ReportModal/actions.js
- superset-frontend/src/features/reports/ReportModal/actions.ts
- superset-frontend/src/features/reports/ReportModal/reducer.js
- superset-frontend/src/features/reports/ReportModal/reducer.ts
-
Files skipped - 0
-
Tools
- Eslint (Linter) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
|
|
||
| interface SliceUpdatedAction { | ||
| type: typeof actions.SLICE_UPDATED; | ||
| slice: Omit<Slice, 'owners'> & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SliceUpdatedAction interface expects owners as Array<{value: number; label: string}>, but the action creator sliceUpdated takes Slice with owners as number[]. This mismatch could cause runtime failures in the reducer handler when mapping owner.value, as the handler assumes owners are objects with value/label properties.
Code suggestion
Check the AI-generated fix before applying
| slice: Omit<Slice, 'owners'> & { | |
| slice: Slice & { |
Citations
- Rule Violated: dev-standard.mdc:16
Code Review Run #706562
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
- actions.ts: add error handling to editReport, guard against empty charts - chartAction.ts: fix RootState type, cast SupersetClient calls, add AnnotationLayerWithOverrides type Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review Agent Run #dcfec9Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Summary
Migrates 15 core JavaScript/JSX files and 11 test files to TypeScript as part of the ongoing frontend modernization effort.
Files Migrated
Utilities & Middleware (3 files)
src/utils/common.js→common.tssrc/middleware/loggerMiddleware.js→loggerMiddleware.tssrc/visualizations/presets/MainPreset.js→MainPreset.tsReports (2 files)
src/features/reports/ReportModal/actions.js→actions.tssrc/features/reports/ReportModal/reducer.js→reducer.tsExplore (6 files)
src/explore/exploreUtils/index.js→index.tssrc/explore/reducers/exploreReducer.js→exploreReducer.tssrc/explore/components/EmbedCodeContent.jsx→EmbedCodeContent.tsxsrc/explore/components/ExploreChartHeader/index.jsx→index.tsxsrc/explore/components/ExploreViewContainer/index.jsx→index.tsxsrc/explore/components/useExploreAdditionalActionsMenu/index.jsx→index.tsxChart & Datasource (4 files)
src/components/Chart/chartAction.js→chartAction.tssrc/components/Chart/ChartRenderer.jsx→ChartRenderer.tsxsrc/components/Datasource/components/DatasourceEditor/DatasourceEditor.jsx→DatasourceEditor.tsxsrc/components/Datasource/utils/index.js→index.tsKey Improvements
anytypes used throughoutTesting Instructions
npm run type(note: pre-existing TS6305 errors in packages/plugins are unrelated)npm run lintnpm run test -- --testPathPattern="(common|logger|MainPreset|ReportModal|exploreUtils|exploreReducer|EmbedCodeContent|ExploreChartHeader|ExploreViewContainer|useExploreAdditionalActionsMenu|chartAction|ChartRenderer|DatasourceEditor)"Additional Information
This PR excludes dashboard-related files which will be migrated in a separate PR due to their interconnected nature.
🤖 Generated with Claude Code