feat(web): add error boundaries, loading skeletons, render fixes and tree-shaking
- Add error.tsx to all 13 route groups: admin, allocations, analytics, dashboard, estimates, notifications, projects, reports, resources, roles, staffing, timeline, vacations - Add loading.tsx to 9 routes that were missing them: admin, analytics, dashboard, estimates, notifications, reports, roles, staffing, vacations - ResourceDetail: wrap vacationStart in useMemo to stabilize query key, remove dead windowEnd variable - node-renderer.ts: replace barrel import (import * as THREE) with named imports for tree-shaking - next.config.ts: add framer-motion and @capakraken/shared to optimizePackageImports Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import dynamic from "next/dynamic";
|
||||
import type { AllocationLike, AllocationReadModel, AllocationWithDetails, Resource, SkillEntry } from "@capakraken/shared";
|
||||
@@ -96,8 +96,6 @@ export function ResourceDetail({ resourceId }: ResourceDetailProps) {
|
||||
|
||||
// Fetch allocations for this resource (all non-cancelled)
|
||||
const now = new Date();
|
||||
const windowEnd = new Date(now);
|
||||
windowEnd.setDate(windowEnd.getDate() + 90);
|
||||
|
||||
const _allocQuery = trpc.allocation.listView.useQuery(
|
||||
{ resourceId },
|
||||
@@ -110,8 +108,12 @@ export function ResourceDetail({ resourceId }: ResourceDetailProps) {
|
||||
const loadingAllocations = _allocQuery.isLoading;
|
||||
|
||||
// Fetch upcoming/recent vacations
|
||||
const vacationStart = new Date(now);
|
||||
vacationStart.setMonth(vacationStart.getMonth() - 1);
|
||||
const vacationStart = useMemo(() => {
|
||||
const d = new Date();
|
||||
d.setMonth(d.getMonth() - 1);
|
||||
d.setHours(0, 0, 0, 0);
|
||||
return d;
|
||||
}, []);
|
||||
|
||||
const { data: vacations, isLoading: loadingVacations } = trpc.vacation.list.useQuery(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user