fix(board): tiles order not respected on firefox (#1770)

This commit is contained in:
Meier Lukas
2024-12-24 14:15:58 +01:00
committed by GitHub
parent b9483379dd
commit 8893b72fe3

View File

@@ -10,6 +10,12 @@ import { useSectionContext } from "./section-context";
export const SectionContent = () => {
const { section, innerSections, refs } = useSectionContext();
const board = useRequiredBoard();
/**
* IMPORTANT: THE ORDER OF THE BELOW ITEMS HAS TO MATCH THE ORDER OF
* THE ITEMS RENDERED WITH GRIDSTACK, OTHERWISE THE ITEMS WILL BE MIXED UP
* @see https://github.com/homarr-labs/homarr/pull/1770
*/
const sortedItems = useMemo(() => {
return [
...section.items.map((item) => ({ ...item, type: "item" as const })),
@@ -19,7 +25,7 @@ export const SectionContent = () => {
return itemA.xOffset - itemB.xOffset;
}
return itemA.yOffset - itemB.xOffset;
return itemA.yOffset - itemB.yOffset;
});
}, [section.items, innerSections]);