Optimize shot table loading performance

- Pass episode_id filter to backend API instead of client-side filtering,
  reducing payload size when an episode is selected
- Skip getShot refetch in ShotDetailPanel when initialShot prop is provided
- Fix redundant DB query in list_shots: read project.custom_task_statuses
  directly from the already-fetched project object
- Add missing indexes on Task.shot_id, Task.assigned_user_id,
  Task.deleted_at and Episode.project_id; add add_perf_indexes.py
  migration script to apply them to existing databases
- Center login page layout
- Update CLAUDE.md and AGENTS.md with correct venv path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 00:30:18 +08:00
parent 0dd37d1706
commit 0acf9ddff2
13 changed files with 151 additions and 81 deletions
@@ -138,7 +138,7 @@ const isCollapsed = computed(() => state.value === 'collapsed')
// Check if on shot page - show column switch only on shot pages
const isOnShotPage = computed(() => {
return route.path.includes('/shots') || route.path.includes('/project/')
return route.path.endsWith('/shots') || route.path.includes('/project/')
})
const props = withDefaults(defineProps<SidebarProps>(), {
+17 -1
View File
@@ -152,6 +152,7 @@
@update:column-visibility="handleColumnVisibilityChange"
@update:rowSelection="handleRowSelectionChange"
@row-click="handleRowClick"
@row-dblclick="handleRowDoubleClick"
/>
</div>
</div>
@@ -172,6 +173,7 @@
<ShotDetailPanel
:project-id="projectId"
:shot-id="selectedShot.id"
:initial-shot="selectedShot"
@edit="editShot"
@delete="deleteShot"
@create-task="handleCreateTask"
@@ -189,6 +191,7 @@
v-if="selectedShot"
:project-id="projectId"
:shot-id="selectedShot.id"
:initial-shot="selectedShot"
@edit="editShot"
@delete="deleteShot"
@create-task="handleCreateTask"
@@ -278,6 +281,7 @@
<script setup lang="ts">
import { ref, computed, watch, shallowRef, markRaw, nextTick, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import {
Search, Plus, Camera, AlertCircle, RefreshCw,
Layers, MoreHorizontal, Edit, ListTodo, Trash2
@@ -336,6 +340,7 @@ interface Props {
const props = defineProps<Props>()
// Composables
const router = useRouter()
const { toast } = useToast()
const taskStatusesStore = useTaskStatusesStore()
@@ -355,6 +360,13 @@ const {
sessionStorageKey: 'shotBrowser.detailPanelEnabled'
})
// Handle double-click to navigate to shot detail page
const handleRowDoubleClick = (shot: Shot) => {
if (props.projectId) {
router.push(`/projects/${props.projectId}/shots/${shot.id}`)
}
}
// Reactive state
const shots = ref<Shot[]>([])
const isLoading = ref(false)
@@ -430,7 +442,10 @@ const loadShots = async () => {
if (taskStatusFilter.value) {
options.taskStatusFilter = taskStatusFilter.value
}
if (episodeFilter.value !== null) {
options.episodeId = episodeFilter.value
}
const data = await shotService.getShots(options)
shots.value = data
} catch (err) {
@@ -524,6 +539,7 @@ const clearValidationError = () => {
const handleEpisodeFilterChange = (episodeId: number | null) => {
episodeFilter.value = episodeId
loadShots()
}
const handleTaskStatusFilter = (filter: string) => {
@@ -301,6 +301,7 @@ interface Task extends TaskStatusInfo {
interface Props {
projectId: number
shotId: number
initialShot?: Shot
}
interface Emits {
@@ -387,7 +388,7 @@ const loadShotDetails = async () => {
try {
isLoading.value = true
error.value = null
shot.value = await shotService.getShot(props.shotId)
shot.value = props.initialShot ?? await shotService.getShot(props.shotId)
loadTasks() // No longer async - uses embedded data
} catch (err) {
error.value = err instanceof Error ? err.message : 'Failed to load shot details'