Skip to content

Commit 0b70a82

Browse files
committed
Deep clone warrants array before processing
1 parent 0e1d146 commit 0b70a82

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ProtectedRoute.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ const ProtectedRoute: React.FunctionComponent<ProtectedRouteProps> = ({
3131
};
3232

3333
if (sessionToken) {
34-
warrants.forEach((warrant) => {
34+
let warrantsToCheck = [...warrants].map(warrant => ({...warrant}));
35+
warrantsToCheck.forEach((warrant) => {
3536
if (computedMatch.params[warrant.objectId]) {
3637
/** @ts-ignore */
3738
warrant.objectId = computedMatch.params[warrant.objectId];
@@ -42,7 +43,7 @@ const ProtectedRoute: React.FunctionComponent<ProtectedRouteProps> = ({
4243
}
4344
})
4445

45-
checkForWarrant({ op, warrants });
46+
checkForWarrant({ op, warrants: warrantsToCheck });
4647
}
4748
}, [sessionToken]);
4849

0 commit comments

Comments
 (0)