refactor: reduce dead code & duplication in apps/web#32
Merged
Conversation
- 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
|
🎉 This PR is included in version 1.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
Eliminated 23 dead files and reduced code duplication from 3.8% to 1.4% in
apps/webusingfallowanalysis.Changes
Dead code removal
nav-header,theme-toggle, old ticket components (ticket-description,ticket-reporter,ticket-status-form,ticket-timeline), entireui/empty/andui/form/directories,reporter/types.ts,src/index.tsShared server utilities (
$lib/server/helpers.ts)requireAuth(event)— throws 401 if unauthenticated, returns usergetFormString,getFormBool,getFormNullableString— typed form extractionrequireExists(entity, label)— throws 404 if null/undefinedRefactored 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: sharedparseTicketFiltersutilitytickets/[id]/+page.server.ts:requireAuth,requireExists, extractedticketCode()+statusLabelsTesting
svelte-check: 0 errors, 0 warningsprettier: all files formatted