Repository navigation
refactor: split the five files over 500 lines - #48
Merged
Merged
Conversation
pdf.tsx goes from 542 to 61 lines: theme, building blocks, narrative sections and detail tables move to pdf-parts/. The rendered PDF is byte-identical apart from its timestamp and document id.
ConnectWizard goes from 586 to 199 lines: provider list, field definitions and each step move to connect-wizard/. All eight wizard steps render the same HTML and pixels as before. Two placeholders change because the secret check reads moved lines as new: the Google key example said RSA PRIVATE KEY, which service account keys are not, and the AWS one was a full example key.
SsoSettings goes from 566 to 155 lines: types, a useSsoProvider hook, the forms and the provider details move to sso/. The four actions share one request helper, which now shows the fallback message when a response is not JSON instead of a parse error. Nine SSO scenarios render the same HTML and pixels as before.
page.tsx goes from 540 to 84 lines: the flow state moves to useLoginFlow, the SSO lookup to resolve-sso, the forms to login-forms (the email-code and authenticator forms become one CodeForm). Each step is now its own component, so React no longer reuses the email input as the next step's field: the authenticator code field used to open pre-filled with the email address. Going back still keeps the typed email. Seventeen sign-in scenarios checked against the previous page, plus a real sign-in.
DashboardCanvas goes from 734 to 200 lines: presets and saves move to usePresets, drag-to-swap and squeeze-resize to useGridGestures, the toolbar and per-widget controls to their own components, under canvas/. A scripted session (customize, add menu, swap, resize, rename, source filter, reset, zoom) saves the same four layouts and renders the same screenshots as before; the failed-save bar behaves the same.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #30: the five files over 500 lines raised in the DevSecOps review. The other 25 files over 200 lines follow in the next PRs.
src/components/dashboard/DashboardCanvas.tsxsrc/components/settings/ConnectWizard.tsxsrc/components/settings/SsoSettings.tsxsrc/lib/reports/pdf.tsxsrc/app/(auth)/login/page.tsxEach leaves the
OVER_LIMITlist; every new file is under 200 lines. Comments that moved are rewritten as one sentence.How each split was checked
The same scripted browser session ran on the old and the new code, with server responses mocked where a step would write data:
Behaviour changes, all small
RSA PRIVATE KEY(service account keys arePRIVATE KEY), the AWS one was a full example key.Verified
make checkgreen, integration suite 110/110.