Skip to content

Refactor/split publish api - #1492

Merged
greatest0fallt1me merged 6 commits into
CalloraOrg:mainfrom
Opulencechuks:refactor/split-publish-api
Nov 26, 2026
Merged

greatest0fallt1me merged 6 commits into
CalloraOrg:mainfrom
Opulencechuks:refactor/split-publish-api

Conversation

@Opulencechuks

Copy link
Copy Markdown
Contributor

Closes #1396

Summary

Splits the 1,465-line src/pages/PublishApi.tsx into focused, maintainable modules under src/pages/publish/ with identical runtime behaviour, DOM structure, accessibility wiring, draft persistence, and payload shaping.

Changes

  • src/pages/publish/model.ts: Pure types, constants (INITIAL_FORM, INITIAL_TOUCHED, CATEGORIES, DRAFT_STORAGE_KEY, ENDPOINTS_ERROR_ID, FIELD_ALIASES), validation helpers (validateForm, validateEndpoints, findDuplicateEndpointIds, fieldStatus), draft shape guard (isPublishFormDraft), server error mapping (normalizeFieldKey, toValidationErrors), and payload builder (toPublishPayload). No React imports.
  • src/pages/publish/usePublishForm.ts: Encapsulates form state, touched tracking, useFormPersistence, useBeforeUnload, throttled description remaining-character announcements, focus management on endpoints-only errors, and idempotent submission via submitPublishApi.
  • src/pages/publish/BasicsStep.tsx: Renders the API details fieldset (name, base URL, category, description, and pa-description-counter-live polite region) with a pricingSlot to preserve exact DOM and tab order.
  • src/pages/publish/PricingStep.tsx: Renders the per-call USDC pricing input.
  • src/pages/publish/EndpointEditor.tsx: Exports OpenApiImportSection (importer toggle + OpenAPIImport) and EndpointEditor (endpoint list, duplicate flagging, removal, and pa-endpoints-error aria-describedby wiring).
  • src/pages/publish/ReviewSummary.tsx: Exports ReviewSummary (form footer, form-level error alert, submit button) and PublishSuccessView (post-submission confirmation screen).
  • src/pages/publish/publish.css: Extracted stylesheet from the former STYLES template string with identical selectors and rule order.
  • src/pages/PublishApi.tsx: Reduced to a 136-line composition root preserving the default export for lazy loading in src/App.tsx and src/renderRoute.tsx.
  • src/pages/publish/model.test.ts: Unit test suite covering validation, duplicate endpoint detection, draft guard, server error alias mapping, and toPublishPayload.
  • docs/Architecture.md: Added module map for src/pages/publish/.

Verification

  • bun test src/pages/publish/model.test.ts: 20 passed, 0 failed.
  • tsc -p tsconfig.json --noEmit filtered to PublishApi and src/pages/publish/: 0 TypeScript errors.
  • Verified DOM structure, element order, id/aria-* attributes, draft key (callora:publish-api:draft), validation messages, and payload shape remain byte-identical.

…o fix/rate-limit-per-api

# Conflicts:
#	src/App.tsx
#	src/data/mockApis.ts
#	src/pages/ApiDetailPage.tsx
#	src/pages/RateLimitCard.test.tsx
#	src/pages/RateLimitCard.tsx
#	src/renderRoute.tsx
#	src/routeMatchers.ts
@drips-wave

drips-wave Bot commented Nov 24, 2026

Copy link
Copy Markdown

@Opulencechuks Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
greatest0fallt1me merged commit f1a3035 into CalloraOrg:main Nov 26, 2026
1 check passed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

Thanks @Opulencechuks! Merged. 🎉

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.

Split PublishApi.tsx into step components and hooks

2 participants