fix: random movie index after data refetch
This commit is contained in:
1 parent
5de54fd03f
commit
b2e973e09e
1 file changed
+5
@@ -26,6 +26,11 @@ const useRandomMovie = () => {
|
||||
[data]
|
||||
);
|
||||
|
||||
if (movies?.length && !movies[index]) {
|
||||
setIndex(0);
|
||||
setIndexRef(0);
|
||||
}
|
||||
|
||||
return {
|
||||
index,
|
||||
movies,
|
||||
|
||||
Reference in new issue
Block a user