Repository navigation
fix(import): make the artwork phase a line, and stop paying for closed menus - #30
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
useRefreshEntrydo 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
/librarycontinua 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-visibilitynã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 oStrictModeresponde 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