refactor(capture): memoize writable lists in the capture bar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef16778ef5
commit
090d11d4c3
1 file changed
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState, useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
Mic,
|
Mic,
|
||||||
MicOff,
|
MicOff,
|
||||||
@@ -38,7 +38,8 @@ export const InstantCaptureBar: React.FC<InstantCaptureBarProps> = ({
|
|||||||
hideTargetPicker = false,
|
hideTargetPicker = false,
|
||||||
fixedTarget,
|
fixedTarget,
|
||||||
}) => {
|
}) => {
|
||||||
const writableLists = lists.filter((l) => l.isOwner || l.role !== 'viewer');
|
// Read-only shared lists cannot take new items; stable reference for the effect below
|
||||||
|
const writableLists = useMemo(() => lists.filter((l) => l.isOwner || l.role !== 'viewer'), [lists]);
|
||||||
const [content, setContent] = useState('');
|
const [content, setContent] = useState('');
|
||||||
const [priority, setPriority] = useState<PriorityLevel>('normal');
|
const [priority, setPriority] = useState<PriorityLevel>('normal');
|
||||||
const [dueDate, setDueDate] = useState('');
|
const [dueDate, setDueDate] = useState('');
|
||||||
|
|||||||
Reference in new issue
Block a user