Skip to content

fix(picker): no abortar el catálogo remoto al re-renderizar constraints - #253

Merged
IAnMove merged 1 commit into
developmentfrom
fix/catalog-picker-stale-refetch
Sep 7, 2026
Merged

fix(picker): no abortar el catálogo remoto al re-renderizar constraints#253
IAnMove merged 1 commit into
developmentfrom
fix/catalog-picker-stale-refetch

Conversation

@cursor

@cursor cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown

Resumen ejecutivo

Qué cambia

El catálogo remoto del explorer deja de relanzar (y abortar) la petición cada vez que el padre recrea el objeto constraints con el mismo filtro.

Para qué sirve

Si el preview del Video Editor (u otro padre) se re-renderiza mientras From HocusPocus está abierto —por ejemplo con el vídeo en reproducción— el picker ya no se queda en loading infinito.

Impacto para el usuario

From HocusPocus / explorer compartido carga la página de vídeos aunque el montaje siga reproduciéndose detrás del modal.

Riesgo

  • Bajo
  • Medio
  • Alto

Estado

  • Listo para revisión

Summary

useRemoteCatalogPage refetching depended on constraints object identity. VideoEditorPanel (PR 251) and other callers pass an inline { kinds, maxCount, optional } object, so any parent rerender aborted the in-flight /api/v1/assets request. With the preview playing, onTimeUpdate rerenders often enough that the explorer never reached ready.

The effect now keys on a stable kinds string (remoteCatalogFilterKey) instead of the constraints object. Pagination, search, workspace and kind changes still refetch.

Overview

Open From HocusPocus (or any remote AssetExplorerDialog) while the parent keeps rerendering. The first catalog request completes; rebuilding the same constraints object does not start a second request. Changing page, search, workspace or kinds still fetches again.

Detailed changes

Backend

None.

UI and Wizard

  • remoteCatalog.ts: remoteCatalogFilterKey + effect deps use the kinds string.
  • Tests cover key stability and a dialog rerender that must not refetch.

Data, provenance and compatibility

No draft or catalog schema change.

Files and ownership

  • ui/src/features/asset-picker/remoteCatalog.ts
  • ui/tests/remoteCatalog.test.ts
  • ui/tests/assetExplorerRemote.test.tsx

Left untouched: VideoEditorPanel (inline constraints is safe once the hook ignores identity), Studio pickers, backend assets router.

Validation

  • Date (UTC): 2026-09-07

  • Base SHA: bd1b3bc

  • Head SHA: 6a48a30

  • Validation scope: focused

  • python scripts/verify_clean_repo.py

  • python -m compileall -q app/services app/launch.py scripts

  • Focused Python tests: N/A

  • cd ui && npm run i18n:check

  • UI tests: npx tsx --tsconfig tsconfig.app.json --import ./tests/setupI18n.ts --test tests/remoteCatalog.test.ts tests/assetExplorerRemote.test.tsx — 11/11 pass

  • cd ui && npm run lint -- --max-warnings=0

  • cd ui && npm run build

  • git diff --check

  • E2E/smoke checks: N/A (picker contract; no GPU)

Code quality

  • Score: pending CI
  • Complexity trend: pending CI
  • Production LOC trend: pending CI
  • Regression versus main: pending CI
  • Ratchet: pending CI

CI and review

  • CI of this HEAD: pending
  • Independent agent review of this HEAD: pending
  • Human merge click (operational, not code review): pending
  • Pending

Coste de la tarea

  • Tests simulados: 0 tokens externos
  • Tests reales: N/A
  • Llamadas LLM externas: 0
  • Tokens de prompt: N/A
  • Tokens de respuesta: N/A
  • Tokens totales: N/A
  • Generaciones de imágenes/audio/vídeo: 0
  • Tiempo transcurrido: N/A
  • Proveedores/modelos: N/A

Notes and limitations

Found while reviewing PR 251 (shared catalog picker in Video Editor). The hook bug already affects every remote explorer that passes an inline constraints object.

Follow-up work

None.

Checklist

  • The executive summary is understandable without reading the code.
  • The detailed Summary/Overview has not been removed or shortened.
  • Tests and their actual results are recorded.
  • Generated assets, secrets and local-only files are not committed.
  • Required CI and Cursor/Bugbot review are complete, or the PR is clearly marked as waiting for them.
Open in Web View Automation 

Note

Low Risk
Narrow React hook dependency change in the asset picker; no API, auth, or data-model changes.

Overview
Fixes infinite loading in the remote asset explorer when a parent re-renders often (e.g. video preview onTimeUpdate) while passing a fresh inline constraints object with the same kinds.

useRemoteCatalogPage now depends on a stable remoteCatalogFilterKey (selected kind or joined constraints.kinds) instead of the whole constraints reference, so equivalent filters no longer restart the catalog request and mark the in-flight response stale. Pagination, search, workspace, sort, retry, and real kind changes still trigger a fetch.

Unit tests cover key stability; an integration test asserts AssetExplorerDialog does not call /api/v1/assets again after a rerender with equivalent constraints.

Reviewed by Cursor Bugbot for commit 6a48a30. Configure here.

El explorer remoto dependía de la identidad del objeto constraints.
Cualquier re-render del padre (p. ej. el preview del Video Editor en
reproducción) abortaba la petición y el picker se quedaba en loading.

Co-authored-by: ignaciodelcano+dcl <ignaciodelcano+dcl@gmail.com>
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

PR Review — Loreframe Studio

Risk: low
Scope: 3 file(s); +68/-2; React UI

Automated review from scripts/analyze_pr.py. This is a heuristic pass (no LLM) so humans still own the merge decision.

Findings

  • low — UI changed — rebuild before merge
    Run cd ui && npm run build (CI already does this). Pinokio Update rebuilds for end users; keep ui/dist untracked.

Changed files

  • modified: ui/src/features/asset-picker/remoteCatalog.ts, ui/tests/assetExplorerRemote.test.tsx, ui/tests/remoteCatalog.test.ts

CONTRIBUTING checklist

  • python scripts/verify_clean_repo.py
  • python -m compileall -q app/services app/launch.py scripts
  • cd ui && npm run build if the UI changed
  • No weights, CivitAI sidecars, or generated guides
  • Stays local-first (no required accounts / telemetry)

Posted by the repo PR review workflow. Re-runs on each push to the PR.

@IAnMove
IAnMove marked this pull request as ready for review September 7, 2026 21:21
@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Author

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7c030977-1474-4448-94e7-37afce7eccc1)

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Code health

Quality score: 54.7/100

Higher is better. The score is a trend dashboard; the independent ratchet below remains the CI gate.

Component Weight Current Change
Cyclomatic health 45% 54.4 +0.0
File concentration 25% 61.3 +0.0
Oversized-file debt 20% 37.0 +0.0
Modularity 10% 75.2 +0.0

Change vs PR base: +0.0 points.

Metric Value
Production LOC 264,103
Production files 701
Test LOC 93,144
Functions measured 17,018
Functions complexity ≥ 15 832
Maximum complexity 672
Policy code-health-policy-v1
HEAD 65a82bed2ff83bc8fba6beb8575e9639685e8ca4
Base bd1b3bca5bba0a65fc327613bf58e0d70665027a
UI measurement complete

Markdown, JSON catalogs and tests are out of this table. Only app/ runtime + ui/src TS/JS count.

Most complex functions

Complexity Where
672 app/wgp.py:7219 generate_video
381 ui/src/stores/useStore.ts:4053 Async method 'startGeneration'
355 app/_launch_runtime.py:23581 _run_generation
308 app/wgp.py:12359 generate_video_tab
268 ui/src/stores/useStore.ts:8600 Async method 'loadSettingsFromOutput'
258 app/services/director/planners/short_film.py:3433 ShortFilmPlanner._plan_story_driven
258 ui/src/components/Sidebar/SceneAnimatorPanel.tsx:493 Function 'SceneAnimatorPanel'
248 app/services/director_pipeline.py:13607 _run_video_generation
245 app/services/director_pipeline.py:7712 _run_pipeline
244 ui/src/features/agent/agentActions.ts:1145 Function 'parseAction'
226 app/services/director_pipeline.py:6541 update_comic_preview
225 ui/src/features/agent/agentActions.ts:2892 Async function 'executeAgentActions'

Trend vs baseline

Metric Δ
Production LOC +9
Test LOC +57
Functions ≥ 15 +0
Maximum complexity +0

Warnings

  • production LOC increased by +9

Ratchet passed.

@IAnMove
IAnMove merged commit c5662a3 into development Sep 7, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants