Skip to content

Commit 8ac4e7d

Browse files
committed
Move AbortController into makeJottingsRequests()
1 parent 725c0a5 commit 8ac4e7d

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

components/JottingsControls/jottingsControl.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@ import { compareArrays } from "../../libs/arrayExtensions";
1010
export default function JottingsControl(props) {
1111
const [notes, setNotes] = useState(null);
1212
const [tasks, setTasks] = useState(null);
13-
14-
const ownAbortController = new window.AbortController();
15-
const sharedAbortController = new window.AbortController();
16-
13+
1714
const getJotsToShow = (response, jotType) => {
1815
if (
1916
response[1].status === "rejected" &&
2017
response[0].status === "fulfilled"
21-
)
18+
)
2219
return response[0].value[jotType];
23-
else if (
24-
response[1].status === "fulfilled" &&
20+
else if (
21+
response[1].status === "fulfilled" &&
2522
response[0].status === "fulfilled"
2623
)
2724
return [...response[0].value[jotType], ...response[1].value[jotType]];
@@ -35,6 +32,9 @@ export default function JottingsControl(props) {
3532
};
3633

3734
const makeJottingsRequests = async (interval) => {
35+
const ownAbortController = new AbortController();
36+
const sharedAbortController = new AbortController();
37+
3838
if (notes === -1 || tasks === -1) {
3939
console.info("Interval cleared due to errors");
4040
clearInterval(interval);

0 commit comments

Comments
 (0)