Solid start createResource not fetching as first route

Hi all, I'm new to solid start and been trying to create a simple pokemon project that fetches pokemons, lists them in a grid (/pokemon-finder) and then you can click them to get to the details page (/pokemon-finder/:pokemon-name). The problem I have is with the details page itself: whenever I navigate from the list, everything works fine. However, when I reload the page on the details page itself, the resource stays loading forever. I'm using createResouce on both pages: one for the pokemon list on the parent route/component and one for the details in the details page
export default function Details() {
const pokemonName = useLocation().pathname.split("/").at(-1)!
const [pokemon] = createResource<PokemonDetails>(() =>
fetchPokemonData(pokemonName)
)
...
export default function Details() {
const pokemonName = useLocation().pathname.split("/").at(-1)!
const [pokemon] = createResource<PokemonDetails>(() =>
fetchPokemonData(pokemonName)
)
...
I just want to understand why this happens in this route, but the parent pokemon list works fine in every case. Thanks!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server