1 parent de95668 commit 673181bCopy full SHA for 673181b
1 file changed
client/pages/search/[[...query]].js
@@ -1,4 +1,4 @@
1
-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";
2
import getConfig from "next/config";
3
import { useRouter } from "next/router";
4
import qs from "qs";
@@ -11,7 +11,11 @@ import Box from "../../components/Box";
11
import TorrentList from "../../components/TorrentList";
12
13
const Search = ({ results, error, token }) => {
14
- const [torrents, setTorrents] = useState(results?.torrents ?? []);
+ const [torrents, setTorrents] = useState([]);
15
+
16
+ useEffect(() => {
17
+ setTorrents(results?.torrents ?? []);
18
+ }, [results?.total]);
19
20
const router = useRouter();
21
let {
0 commit comments