mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 20:06:08 +01:00
Merge remote-tracking branch 'origin/main' into react/collections
; Conflicts: ; pnpm-lock.yaml
This commit is contained in:
@@ -22,7 +22,6 @@ const FormCheckbox = memo(({ name, disabled, label, currentValue, onChange, hint
|
||||
const labelRef = useRef<HTMLLabelElement>(null);
|
||||
const id = useUniqueName(name);
|
||||
|
||||
// Fix: Move useEffect outside conditional
|
||||
useEffect(() => {
|
||||
if (!hint || !labelRef.current) return;
|
||||
|
||||
@@ -34,22 +33,19 @@ const FormCheckbox = memo(({ name, disabled, label, currentValue, onChange, hint
|
||||
return () => tooltipInstance?.dispose();
|
||||
}, [hint]); // Proper dependency
|
||||
|
||||
// Memoize style object
|
||||
const labelStyle = useMemo(() =>
|
||||
hint ? { textDecoration: "underline dotted var(--main-text-color)" } : undefined,
|
||||
[hint]
|
||||
);
|
||||
|
||||
// Memoize onChange handler
|
||||
const handleChange = useCallback((e: Event) => {
|
||||
onChange((e.target as HTMLInputElement).checked);
|
||||
}, [onChange]);
|
||||
|
||||
// Memoize title attribute
|
||||
const titleText = useMemo(() => hint ? escapeQuotes(hint) : undefined, [hint]);
|
||||
|
||||
return (
|
||||
<div className="form-checkbox" style={containerStyle}>
|
||||
<div className={`form-checkbox ${disabled ? "disabled" : ""}`} style={containerStyle}>
|
||||
<label
|
||||
className="form-check-label tn-checkbox"
|
||||
style={labelStyle}
|
||||
|
||||
Reference in New Issue
Block a user