Monorepo for Tangled tangled.org

web: stop issues and pulls crashing after a hover preload #4651

Merged naikaayush.com
targeting master from naikaayush.com/core:fix/ticket-list-hover-preload-crash
Merged opened by and assigned to naikaayush.com
targeting master from naikaayush.com/core:fix/ticket-list-hover-preload-crash

if you hover issues on the repo overview for a bit and then click it, you get an internal error. clicking straight away works.

what's happening:

  • hovering preloads the issues page
  • if the search takes over 200ms, settle() leaves issues as a promise, and a long hover gives it time to resolve before you click
  • {#await} runs {:then} in its own batch, so an already resolved promise fires it while the navigation batch is still in progress
  • that batch still sees the old tree, so data is the overview page's data and withoutStates(data.query) throws on undefined

hovering isn't actually required. giving {#await} an already resolved promise crashes it with no hover too.

the fix swaps {#await} for a nested <Pending> with {@const issues = await data.issues}, which stays in the navigation's batch. same pattern the page already uses for data.repo. pulls has the same structure so it gets the same change.

tested on tangled.org/core:

  • issues crashed every time with a 3-5s hover before the fix
  • issues and pulls both load fine now with an instant click and a 3s hover
  • i never reproduced the crash on pulls itself, that change is based on it having the same structure

screenshot: https://cleanshot.com/share/8wPtwQ8G

Commits 1

web: stop issues and pulls crashing after a hover preload