Remove /core/apps directory and move perpetua to features/perpetua - #142
Conversation
|
Code Review: Remove /core/apps directory and move perpetua to features/perpetua Overview This is a large structural cleanup PR removing the entire legacy src/alex_frontend/core/apps/ directory (~25,000 lines). The new features/perpetua implementation already on the base branch replaces it with a modern React Query + minimal Redux architecture. The direction is correct. The old core/apps structure mixed server-state into Redux with large thunks and slices, while the new code separates concerns: TanStack Query for server state, Redux only for lightweight UI state (feed type, filters, edit mode). What Is Good
Issues Bug risk in useRemoveItem optimistic update (hooks/useMutations.ts): prev.items is Array<[number, Item]> where the first tuple element is the item ID. This filter checks item.id on the second element. If the Item candid type does not carry an id field, the comparison is always undefined !== itemId and the optimistic remove silently no-ops. The onSettled query invalidation masks this at runtime. Fix: Type safety: as any cast in ShelfCard.tsx line 28: Dynamic URL construction bypasses TanStack Router compile-time route checking. If basePath is not a registered route prefix this silently navigates nowhere. Consider accepting a typed to route as a prop, or restricting basePath to a union of known prefixes. useSetItemOrder has no optimistic update: Unlike the other mutations, this one only invalidates on success. After every drag-and-drop the list briefly flashes back to the original order while the refetch completes. Worth applying the same optimistic pattern used in useRemoveItem. Process Concerns
Summary The cleanup is thorough and the architecture upgrade is the right call. Two items worth addressing before merge: the useRemoveItem filter (potential silent optimistic-update bug depending on the Item DID shape) and the as any cast in ShelfCard. Everything else is an improvement, not a blocker. |
No description provided.