We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3411bc2 commit 2c4c17aCopy full SHA for 2c4c17a
1 file changed
src/app/blog/page.tsx
@@ -143,18 +143,18 @@ export default function Blog() {
143
const loadAllGists = async () => {
144
try {
145
let currentPage = 1;
146
- let allGists: Gist[] = [];
147
let hasMore = true;
148
-
+
149
while (hasMore) {
150
const { gists: pageGists, hasMore: hasMoreGists } = await fetchGists(currentPage);
151
152
- allGists = [...allGists, ...pageGists];
+ // Atualiza os gists incrementalmente
+ setGists(prev => [...prev, ...pageGists]);
153
154
hasMore = hasMoreGists;
155
currentPage++;
156
}
157
- setGists(allGists);
158
setLoading(false);
159
} catch (err) {
160
setError(err instanceof Error ? err.message : 'Erro ao carregar os gists');
0 commit comments