Compare commits

...

2 Commits

Author SHA1 Message Date
HJ 6893806db9 Apply suggestion to src/services/theme_data/theme_data.service.js 2020-07-14 13:02:50 +00:00
Henry Jameson afa76b65b7 fix chrome69 (dungeon master edition) 2020-07-12 16:37:09 +03:00
1 changed files with 6 additions and 3 deletions

View File

@ -128,14 +128,17 @@ export const topoSort = (
while (unprocessed.length > 0) {
step(unprocessed.pop())
}
return output.sort((a, b) => {
// The index thing is to make sorting stable on browsers
// where Array.sort() isn't stable
return output.map((data, index) => ({ data, index })).sort(({ data: a, index: ai }, { data: b, index: bi }) => {
const depsA = getDeps(a, inheritance).length
const depsB = getDeps(b, inheritance).length
if (depsA === depsB || (depsB !== 0 && depsA !== 0)) return 0
if (depsA === depsB || (depsB !== 0 && depsA !== 0)) return ai - bi
if (depsA === 0 && depsB !== 0) return -1
if (depsB === 0 && depsA !== 0) return 1
})
}).map(({ data }) => data)
}
const expandSlotValue = (value) => {