refactor app.js and index.ex #554
Labels
No labels
bug
duplicate
enhancement
help wanted
high priority
invalid
L
low priority
M
medium priority
needs refinement
optional
question
S
technical improvement
UX Improvement
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: local-it/mitgliederverwaltung#554
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
app.js has outgrown a single file
assets/js/app.jsnow holds 13 LiveView hooks in about 735 lines, all defined inline (it was 568 on main; #547 added IndeterminateCheckbox, LoadMorePrefetch, SortTooltip and StickyViewportWidth). This is the JS counterpart of the oversized-module smell the guidelines already flag for.exfiles.The natural fix on LiveView 1.1 is to move component-bound hooks into colocated hooks next to the component that uses them (SortTooltip with the sort header, StickyViewportWidth with the loading bar, IndeterminateCheckbox with the checkbox) and put the cross-cutting ones under
assets/js/hooks/, leaving app.js with just the wiring. The convention should also be written into CODE_GUIDELINES.md as part of the same change.index.ex is a very large LiveView
lib/mv_web/live/member_live/index.exis around 1956 lines with roughly 140 private functions and 20 message handlers (9handle_event, 11handle_info), andmountalone is about 155 lines. The review loop already pulled the export-payload builder into its own module and stopped there on purpose, but the file is still large enough to be hard to navigate.Good candidates to extract later are the filter-message handling, the bulk selection and scope logic together with the mailto/copy/export helpers, and the view-settings toggling, plus breaking
mountinto a few focused setup steps. This is a higher-churn refactor, so it wants its own pass rather than riding along with a feature branch.refactor app.js and encapsulate LiveView JS hooksto refactor app.js and index.ex