For the complete documentation index, see llms.txt. This page is also available as Markdown.

Phase 6: Eliminate Duplicate Index Calls

← Back to Index

Effort: 30 minutes Risk: Low Priority: Medium Previous: Phase 5: Restriction Status Next: Phase 7: Cleanup

Goal

Since currentCanvasIndex is now in context (from Phase 1), remove all duplicate queryParamToArrayIndex(query.canvas) calls across components.

Why?

Before:

// Thumbnails.tsx
const index = queryParamToArrayIndex(query.canvas);

// NoScriptImage.tsx
const index = queryParamToArrayIndex(query.canvas);

// MultipleManifestList.tsx
const index = queryParamToArrayIndex(query.canvas);

Problem: Same calculation repeated in 3+ files.

After:

const { currentCanvasIndex } = useItemViewerContextV2();

Single source of truth!

Files to Update

Find all occurrences:

Expected files (update each):

  1. Thumbnails.tsx (lines 38, 49)

  2. NoScriptImage.tsx (line 42)

  3. MultipleManifestList.tsx (lines 23, 37)

  4. Any others found

Replace pattern:

Testing

Success Criteria

Time: ~30 minutes


Next: Phase 7: Cleanup

Last updated