Skip to content

fix(import): make the artwork phase a line, and stop paying for closed menus - #30

Merged
Digit4w merged 1 commit into
devfrom
fix/import-piece-and-card-cost
Sep 14, 2026
Merged

Digit4w merged 1 commit into
devfrom
fix/import-piece-and-card-cost

Conversation

@Digit4w

@Digit4w Digit4w commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Contraparte: Digit4w/watchpile-server#23 — e ela entra antes desta.

Três coisas que o dono achou usando o app, e a investigação que ele pediu do EntryCard.

A fase de arte parecia uma fonte de import. Ela tinha herdado a casca da caixa de fonte inteira — ring, padding e a marca quadrada de 40px —, então na tela ficava idêntica ao MyAnimeList e ao AniList logo acima: lia-se como um quarto lugar de onde se importa. Não é; é uma tarefa continuando o import que acabou. A marca sai (ela identifica um serviço, e ali não se escolhe serviço nenhum) e a caixa vira linha subordinada atrás de uma divisória.

Cada carta montava o menu, e o menu criava três hooks de mutação mais uma consulta — um observer do TanStack Query cada, construído na montagem. Uma grade de noventa cartas erguia ~360 observers para desenhar menus que ninguém abriu, e o useRefreshEntry do ciclo anterior era um deles. Hook não pode ser condicional, então a condição virou fronteira de componente: o corpo do menu só existe enquanto ele está aberto. Heap na mesma navegação cai de 87 MB para 36 MB.

Os pôsteres chegam em 315×450 a 422×600 e aparecem em 147×210 — 66 MB de bitmap para 70 cartas. decoding="async" não muda quantos pixels são; muda quando eles são pagos, tirando o trabalho do quadro em que a pessoa está olhando. A qualidade fica intacta, por decisão do dono.

O hook da janela da grade também deixou de medir layout depois de todo render — ele não tinha lista de dependências, então cada passagem forçava uma leitura síncrona de layout.

Honesto sobre o que NÃO se moveu: no build de desenvolvimento, voltar de uma obra para /library continua custando 120–140ms de interface parada, igual a antes. Testei três hipóteses e as três caíram — não era o hook, não era layout nem paint (content-visibility não mudou nada), e não eram os observers (ali o ganho foi de memória). O que sobra é o React em modo de desenvolvimento montando 70 componentes, e o StrictMode responde por ~20% disso. Contra o build de produção o mesmo gesto não gera tarefa longa nenhuma, e é assim que Docker e Electron rodam.

Testes: 382.

🤖 Generated with Claude Code

…d menus

Three things the owner found by using it.

The artwork phase looked like an import source. It had borrowed the
source box whole — ring, padding and the 40px brand tile — so on screen
it read as a fourth place to import FROM, sitting right under MyAnimeList
and AniList. It is a task continuing the import that just finished. The
brand goes (it identifies a service, and no service is being chosen here)
and the box becomes a subordinate line behind a divider.

Every card mounted the entry menu, and the menu created three mutation
hooks plus a links query — one TanStack Query observer each, built at
mount. A grid of ninety cards was building roughly 360 observers to draw
menus nobody opened. Hooks cannot be conditional, so the condition
becomes a component boundary: the body only exists while the menu is
open. Measured in production, heap over the same navigation drops from
87MB to 36MB.

Posters arrive at 315x450 to 422x600 and display at 147x210 — 66MB of
decoded bitmap for 70 cards. decoding="async" does not change how many
pixels that is; it changes when they are paid, moving the work out of
the frame someone is looking at.

The grid window hook also stops measuring layout after every render. It
had no dependency array, so each pass forced a synchronous layout read.

Honest about what did NOT move: in the dev build, returning from a title
to /library still costs 120-140ms of frozen UI, the same as before. That
cost is React in development mode building 70 components, and production
already answers in 55ms on the first return and nothing after.
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.

1 participant