#Pokedex

10 messages · Page 1 of 1 (latest)

wanton bear
young oak
#

Looks cute! good job 👌

upper folio
#

I see a flash during load. The SSR version looks fine, then a flash, then looks fine again.

#

Ah ok. On mobile, it changes the amount of Pokemons to load, which makes it load again.
I think you should make the load amount decision inside the fetcher?

wanton bear
# upper folio I see a flash during load. The SSR version looks fine, then a flash, then looks ...

I'm fetching the pokemons inside a useResource$ which tracks the limit value for the number of pokemons.
On mobile, the limit is 10 and on desktop the limit is 16. However, in order to determine the limit, I have a function called isMobile which will check whether window.visualViewport.width <= 992px. As you may have guessed, I'm running it in a useVisibleTask$ since I cannot access window in useTask$.
I see that there is an option for { strategy: 'document-ready' } in useVisibleTask$. I'll try and see if it prevents that flash

upper folio
#

Reading your code some more, I would keep a cache of the pokemons in a store and I would do my own loading rendering instead of useResource

#

Here's the code for Resource, it's just an Inline Component, nothing magical: https://github.com/BuilderIO/qwik/blob/2e96ae030a299e66191627352cb9252057064409/packages/qwik/src/core/use/use-resource.ts#L261-L303

So you can do that same thing, keeping an array of Pokemon and when you need to show beyond what you loaded, show the spinner

GitHub

Instant-loading web apps, without effort. Contribute to BuilderIO/qwik development by creating an account on GitHub.

#

BTW, nice project, looks good 🙂

wanton bear