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:
Felipe Coutinho
2026-02-04 13:14:10 +00:00
parent a70a83dd9d
commit 757626c468
18 changed files with 571 additions and 617 deletions

View File

@@ -1,4 +1,4 @@
import { useCallback, useState } from "react";
import { useState } from "react";
/**
* Hook for managing form state with type-safe field updates
@@ -22,26 +22,23 @@ export function useFormState<T extends Record<string, any>>(initialValues: T) {
/**
* Updates a single field in the form state
*/
const updateField = useCallback(
<K extends keyof T>(field: K, value: T[K]) => {
setFormState((prev) => ({ ...prev, [field]: value }));
},
[],
);
const updateField = <K extends keyof T>(field: K, value: T[K]) => {
setFormState((prev) => ({ ...prev, [field]: value }));
};
/**
* Resets form to initial values
*/
const resetForm = useCallback(() => {
const resetForm = () => {
setFormState(initialValues);
}, [initialValues]);
};
/**
* Updates multiple fields at once
*/
const updateFields = useCallback((updates: Partial<T>) => {
const updateFields = (updates: Partial<T>) => {
setFormState((prev) => ({ ...prev, ...updates }));
}, []);
};
return {
formState,