Skip to content

Audit frontend, fix bugs and enforce linting and type checking - #1041

Open
Irozuku wants to merge 21 commits into
refactor/dead-codefrom
refactor/frontend-audit
Open

Irozuku wants to merge 21 commits into
refactor/dead-codefrom
refactor/frontend-audit

Conversation

@Irozuku

@Irozuku Irozuku commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

An audit of the frontend. It fixes the bugs the audit found, removes unused code and dependencies, and makes yarn lint and yarn typecheck work, so the same problems are caught from now on.

Before this branch the ESLint config enabled no rule and could not parse .ts files, and yarn typecheck failed inside library type files because TypeScript 4.9 was too old. With no frontend tests either, nothing checked the frontend except the build.


Type of Change

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

Changes (by file)

Bugs fixed:

  • components/DatasetVisualization.jsx: fetchDatasets was used without being defined. Opening a dataset that was still processing threw a ReferenceError. It now comes from the surrounding context.
  • components/notebooks/converter/ItemsToDeleteList.jsx, components/notebooks/explorer/plotLayout/PlotLayoutForm.jsx, components/shared/FormSchemaRenderFields.jsx: ten hooks were called after an early return. React requires the same hooks on every render, so these could crash when the condition changed. The early returns now come after the hooks.
  • pages/plugins/components/PluginsTab.jsx, pages/plugins/hooks/usePluginsUpgrade.js, types/plugin.ts: undefined enqueueSnackbar and t, and a plugin status enum that did not match the backend.
  • components/generative/ParamsBar.jsx: the parameter history was loaded once on mount, so after switching sessions it still held the previous session's history.
  • components/configurableObject/FormTooltip.jsx, components/updates/UpdatesDialog.jsx, components/notebooks/documentNotebook/DocumentItemsPanel.jsx, components/notebooks/explorer/visualizations/PlotlyJsonVisualizer.jsx: components that were defined inside another component's render, and so remounted on every render, are now defined once.
  • components/predictions/ManualInput.jsx, ManualInputForm.jsx: a leftover onSubmit stub logged the form rows to the console.
  • utils/i18n/index.js: the hub texts were never registered for German and Portuguese. Locale files are now loaded with import.meta.glob, so a new file cannot be forgotten. The 110 hand written imports are gone.

Unused code removed:

  • package.json: @mui/x-data-grid, @tanstack/react-table, react-uuid, react-virtualized-auto-sizer, react-window, reactflow, @mui/utils and web-vitals. Nothing imports them.
  • src/reportWebVitals.js: Create React App leftover that was called without a callback, so it did nothing.
  • 60 unused imports, local variables, functions and constants across more than 30 files, plus state that was written but never read in six components. no-unused-vars is now an error.
  • 10 leftover debug console.log calls and 2 commented out ones.

Tooling:

  • eslint.config.js: correctness rules as errors (undefined variables, duplicate keys, unreachable code, missing key, rules of hooks); noisier rules as warnings. .ts files are parsed with @typescript-eslint/parser. eslint-plugin-react-hooks added.
  • tsconfig.json, package.json: TypeScript 5, @types/react 18 to match React 18, module resolution for Vite. The template comments in tsconfig.json are dropped.
  • .github/workflows/build-test.yaml: runs yarn lint and yarn typecheck before the build.

Testing (optional)

  • Open a dataset while it is still processing; open the plot layout editor of an explorer; switch the language to German or Portuguese and open the Hub.

Notes (optional)

Found and not changed here. Each is a warning in yarn lint or a note for follow up:

  • 179 react-hooks/exhaustive-deps warnings. They were triaged, not bulk fixed. The 29 useMemo and useCallback cases and the 14 effects most likely to be stale were read one by one: all but one use a deliberate stand-in dependency (an id instead of the object, a serialized key, a search string instead of the filter function) or run once on purpose, several with a comment saying so. Applying the suggested fixes blindly would be harmful; in hooks/generative/useSessions.js it would recreate a refetch loop the code documents. The one real case, the parameter history in ParamsBar.jsx, is fixed. The rule stays a warning.
  • 15 react/no-unstable-nested-components warnings remain. They are table column renderers created inside useMemo and list render callbacks, which are stable. The 5 real cases are fixed.
  • 57 lists that use the array index as key.
  • Bundle size: the largest chunk is 4.9 MB because Plotly is imported eagerly, and routes are not split. The modular refactor branch already splits routes; lazy loading Plotly is still open

@Irozuku
Irozuku added this pull request to stack #1039 November 24, 2026 15:27
@Irozuku Irozuku added bug Something isn't working front Frontend work refactor Prune and embelish code labels Nov 24, 2026
Align PluginStatus with backend and drop nonexistent DOWNLOADED state.
fetchDatasets was read without being defined; it now comes from the surrounding context.
A conditional hook call can crash the render when the condition flips.
…iles

The previous config enabled no rule and could not read .ts files.
TypeScript 4.9 could not parse the type files of current libraries, so the check failed before reaching our code.
Both pass with zero errors.
…submit

The submit handler was a leftover stub; running a prediction goes through onRun.
It was loaded once on mount, so switching sessions kept the previous session's history until the dialog was reopened.
@Irozuku
Irozuku force-pushed the refactor/frontend-audit branch from 7774624 to 0642e24 Compare November 27, 2026 16:48

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working front Frontend work refactor Prune and embelish code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant