refactor: optimize codebase for React 19 compiler (v1.2.6)
React 19 compiler auto-optimizes memoization, making manual hooks unnecessary. Changes: - Remove ~60 useCallback/useMemo across 16 files - Remove React.memo from nav-button and return-button - Simplify hydration with useSyncExternalStore (privacy-provider) - Add CHANGELOG.md for version tracking No functional changes - internal optimization only. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import type { VariantProps } from "class-variance-authority";
|
||||
import { useCallback, useMemo, useState, useTransition } from "react";
|
||||
import { useState, useTransition } from "react";
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -49,22 +49,16 @@ export function ConfirmActionDialog({
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const dialogOpen = open ?? internalOpen;
|
||||
|
||||
const setDialogOpen = useCallback(
|
||||
(value: boolean) => {
|
||||
if (open === undefined) {
|
||||
setInternalOpen(value);
|
||||
}
|
||||
onOpenChange?.(value);
|
||||
},
|
||||
[onOpenChange, open],
|
||||
);
|
||||
const setDialogOpen = (value: boolean) => {
|
||||
if (open === undefined) {
|
||||
setInternalOpen(value);
|
||||
}
|
||||
onOpenChange?.(value);
|
||||
};
|
||||
|
||||
const resolvedPendingLabel = useMemo(
|
||||
() => pendingLabel ?? confirmLabel,
|
||||
[pendingLabel, confirmLabel],
|
||||
);
|
||||
const resolvedPendingLabel = pendingLabel ?? confirmLabel;
|
||||
|
||||
const handleConfirm = useCallback(() => {
|
||||
const handleConfirm = () => {
|
||||
if (!onConfirm) {
|
||||
setDialogOpen(false);
|
||||
return;
|
||||
@@ -78,7 +72,7 @@ export function ConfirmActionDialog({
|
||||
// Mantém o diálogo aberto para que o chamador trate o erro.
|
||||
}
|
||||
});
|
||||
}, [onConfirm, setDialogOpen]);
|
||||
};
|
||||
|
||||
return (
|
||||
<AlertDialog open={dialogOpen} onOpenChange={setDialogOpen}>
|
||||
|
||||
Reference in New Issue
Block a user