Page loading multiple times
Unanswered
Blue Picardy Spaniel posted this in #help-forum
Blue Picardy SpanielOP
Whenever I load my page for the first time after restarting my app, it loads about 3 times. However if the page doesn't call an API then this doesn't happen. How do I fix this?
9 Replies
Crazy ant
@Blue Picardy Spaniel tell the more details to solve the issue
@Crazy ant <@495953543543521280> tell the more details to solve the issue
Blue Picardy SpanielOP
what other details would you like?
Crazy ant
what you use inside this component @Blue Picardy Spaniel
Blue Picardy SpanielOP
const botGuilds = await getBotGuilds();export async function getBotGuilds(): Promise<Guild[] | null> {
const res = await fetch(baseUrl + "/users/@me/guilds", {
headers: {
Authorization: `Bot ${env.BOT_TOKEN}`
}
});
const json = await res.json();
if(!res.ok) {
console.log(json, "getBotGuilds");
return null;
}
const guilds: Guild[] = json
.map((guild: Guild) => ({
id: guild.id,
name: guild.name,
icon: guild.icon,
owner: guild.owner,
permissions: guild.permissions
}));
return guilds;
}Crazy ant
the code is lookes good and okay i dont think this code re render
Blue Picardy SpanielOP
my page definetely loads 3 times
Crazy ant
you can check the parent component as well