mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 13:22:14 +00:00
refactor(insights): leave the arrange editor's sorted rows to the compiler
The draft now comes out of a render-time reconcile, so a manual memo over it could not be preserved and the compiler skipped the component.
This commit is contained in:
1 parent
055cbcff0e
commit
f0fba23c34
1 file changed
+3
-5
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
@@ -50,6 +50,7 @@ import {
|
||||
arrangementSignature,
|
||||
reconcileArrangeDraft,
|
||||
seedArrangeDraft,
|
||||
sortByOrder,
|
||||
} from "@/lib/insights-arrange-draft";
|
||||
import { apiDelete, apiPut } from "@/lib/api/api-fetch";
|
||||
import {
|
||||
@@ -222,10 +223,7 @@ export function InsightsEditMode({
|
||||
arrangementSignature(draftSections) !==
|
||||
arrangementSignature(layout.sections);
|
||||
|
||||
const sections = useMemo(
|
||||
() => [...draftSections].sort((a, b) => a.order - b.order),
|
||||
[draftSections],
|
||||
);
|
||||
const sections = sortByOrder(draftSections);
|
||||
const sectionIds = sections.map((s) => s.id);
|
||||
|
||||
function toggleSection(id: InsightsSectionId, visible: boolean) {
|
||||
|
||||
Reference in new issue
Block a user