Skip to content

refactor: reduce dead code & duplication in apps/web#32

Merged
masmuss merged 5 commits into
mainfrom
refactor/apps-web-fallow
Jun 7, 2026
Merged

refactor: reduce dead code & duplication in apps/web#32
masmuss merged 5 commits into
mainfrom
refactor/apps-web-fallow

Conversation

@masmuss

@masmuss masmuss commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Eliminated 23 dead files and reduced code duplication from 3.8% to 1.4% in apps/web using fallow analysis.

Changes

Dead code removal

  • Deleted 23 unused files: nav-header, theme-toggle, old ticket components (ticket-description, ticket-reporter, ticket-status-form, ticket-timeline), entire ui/empty/ and ui/form/ directories, reporter/types.ts, src/index.ts

Shared server utilities ($lib/server/helpers.ts)

  • requireAuth(event) — throws 401 if unauthenticated, returns user
  • getFormString, getFormBool, getFormNullableString — typed form extraction
  • requireExists(entity, label) — throws 404 if null/undefined

Refactored server routes

  • categories/+page.server.ts: 80→15 lines (shared category actions)
  • settings/+page.server.ts: 177→148 lines (4 category actions replaced)
  • tickets/+page.server.ts + tickets/export/+server.ts: shared parseTicketFilters utility
  • tickets/[id]/+page.server.ts: requireAuth, requireExists, extracted ticketCode() + statusLabels

Testing

  • svelte-check: 0 errors, 0 warnings
  • prettier: all files formatted

masmuss added 5 commits June 7, 2026 12:28
- Deleted unused components: nav-header, theme-toggle, ticket-description,
  ticket-reporter, ticket-status-form, ticket-timeline
- Deleted unused empty subcomponents (empty-content, empty-title, etc.)
- Deleted unused form components (entire ui/form directory)
- Deleted unused barrel export files (reporter/types.ts, src/index.ts)
… routes

- Created $lib/server/helpers.ts with requireAuth, getFormString,
  getFormNullableString, getFormBool, requireExists utilities
- Refactored categories, agents, invite-codes, and settings +page.server.ts
  to use shared helpers, eliminating repeated auth guards, form
  extraction, and existence-check boilerplate
- Settings page benefits most: 7 actions reduced from 212 to 160 lines
  with zero auth boilerplate repetition
… to 1.4%

- Created $lib/server/tickets.ts with shared parseTicketFilters utility
  used by both tickets list and export endpoint
- Created $lib/features/category/category.actions.server.ts with shared
  category CRUD actions, reused by categories and settings routes
- Refactored tickets/[id]/+page.server.ts to use requireAuth, requireExists
  and extracted ticketCode helper + statusLabels map
@masmuss masmuss merged commit c8dcb3b into main Jun 7, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant