Skip to content

refactor(ui): standardize generated client imports to use barrel - #6930

Open
luizhf42 wants to merge 1 commit into
masterfrom
refactor/ui/standardize-client-imports
Open

refactor(ui): standardize generated client imports to use barrel#6930
luizhf42 wants to merge 1 commit into
masterfrom
refactor/ui/standardize-client-imports

Conversation

@luizhf42

Copy link
Copy Markdown
Member

What

All hooks and production code now import generated client symbols (*Options, *QueryKey, *Mutation, types) from the @/client barrel instead of internal submodules (@/client/@tanstack/react-query.gen, @/client/types.gen, @/client/sdk.gen).

Why

Prerequisite for shellhub-io/team#216 (Task 5). Once every hook imports from the barrel, page and component tests only need a single vi.mock("@/client") to intercept all SDK calls — eliminating the need to mock individual submodules or hooks.

Changes

  • openapi-ts.config.ts: added includeInEntry: true to all @hey-api/openapi-ts plugin entries so the barrel re-exports every generated symbol
  • 54 hook files: merged value and type imports from ../client/@tanstack/react-query.gen, ../client/types.gen, and ../client/sdk.gen into a single ../client import
  • 4 production files (ConnectDrawer, BillingSection, License, license.ts): same submodule-to-barrel migration
  • 13 hook tests: changed mock targets from @/client/@tanstack/react-query.gen to @/client
  • 3 component tests (DeviceLimitBanner, LicenseBanner, LicenseGuard): merged separate @/client/@tanstack/react-query.gen mocks into the existing @/client mock block — these tests had split mocks because the hooks previously imported from different submodules
  • 1 page test (WebEndpoints): @/client/sdk.gen@/client

Testing

npm run test passes. The hook and component tests that changed mock targets were the ones that broke when imports moved to the barrel — each was verified individually.

`includeInEntry: true` makes the barrel re-export every generated
symbol (`*Options`, `*QueryKey`, `*Mutation`, types). Importing from
the barrel instead of the internal submodules (`@tanstack/react-query.gen`,
`types.gen`) means tests only ever need to mock `@/client`.
@luizhf42
luizhf42 requested a review from a team as a code owner August 20, 2026 14:04
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

Claude finished @luizhf42's task in 1m 39s —— View job


Code Review Complete

Reviewed 77 files across code quality, security, testing, language patterns, and architecture — no new issues found. The code looks good as-is.

This is a mechanical, uniform migration of generated-client imports to the @/client barrel. Verified spot-checks:

  • openapi-ts.config.tsincludeInEntry: true is correctly added only to the @tanstack/react-query plugin; the @hey-api/typescript/@hey-api/sdk symbols were already barrel-exported (they were imported from ../client before this PR), so the single flag is sufficient.
  • Production hooks/components — value and type imports are correctly merged into a single ../client import with no symbol left behind (e.g. useBilling, useInvitations, useNamespaces, useContainerMutations).
  • Test mocks — the merged vi.mock("@/client", …) factories correctly absorb the former @/client/@tanstack/react-query.gen mocks, matching the hooks' new import surface (e.g. useBilling, useAdminSessions, DeviceLimitBanner/LicenseBanner/LicenseGuard).

If you push additional changes and want a new review, tag @shellhub-io/admin and a team member can trigger it.
· refactor/ui/standardize-client-imports

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant