"fix" the sort function potentially not always outputting results

This commit is contained in:
Henry Jameson 2022-07-31 12:39:02 +03:00
parent fc18673030
commit b44df37c1b

View File

@ -138,6 +138,7 @@ export const topoSort = (
if (depsA === depsB || (depsB !== 0 && depsA !== 0)) return ai - bi if (depsA === depsB || (depsB !== 0 && depsA !== 0)) return ai - bi
if (depsA === 0 && depsB !== 0) return -1 if (depsA === 0 && depsB !== 0) return -1
if (depsB === 0 && depsA !== 0) return 1 if (depsB === 0 && depsA !== 0) return 1
return 0 // failsafe, shouldn't happen?
}).map(({ data }) => data) }).map(({ data }) => data)
} }