Skip to content

Commit 663afa3

Browse files
PR comments
1 parent f574412 commit 663afa3

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,14 @@ export default function AttributeCalculation() {
315315
router.push(`/projects/${projectId}/settings`);
316316
}, []);
317317

318-
const copyToClipboardFunc = useCallback(
319-
(name: string) => () => copyToClipboard(name),
320-
[]
321-
);
318+
const copyToClipboardFunc = useCallback((name: string) => copyToClipboard(name), []);
322319

323320
const usableAttributesFinal = useMemo(() => usableAttributes.map((attribute) => (
324-
{ ...attribute, onClick: copyToClipboardFunc(attribute.name) }
321+
{ ...attribute, onClick: () => copyToClipboardFunc(attribute.name) }
325322
)), [usableAttributes]);
326323

327324
const lookupListsFinal = useMemo(() => lookupLists.map((lookupList) => (
328-
{ ...lookupList, onClick: copyToClipboardFunc("from knowledge import " + lookupList.pythonVariable) }
325+
{ ...lookupList, onClick: () => copyToClipboardFunc("from knowledge import " + lookupList.pythonVariable) }
329326
)), [lookupLists]);
330327

331328
const disabledOptions = useMemo(() => {

src/components/projects/projectId/settings/embeddings/Embeddings.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,10 @@ export default function Embeddings(props: { refetchEmbeddings: () => void }) {
7171
const orgId = useSelector(selectOrganizationId);
7272
useWebsocket(orgId, Application.REFINERY, CurrentPage.PROJECT_SETTINGS, handleWebsocketNotification, projectId, CurrentPageSubKey.EMBEDDINGS);
7373

74-
const openFilterAttributesModal = useCallback((embedding: Embedding) => () => {
75-
embedding.onQdrant ? dispatch(setModalStates(ModalEnum.FILTERED_ATTRIBUTES, { embeddingId: embedding.id, open: true, attributeNames: prepareAttributeDataByNames(embedding.filterAttributes), showEditOption: showEditOption })) : null;
76-
}, [showEditOption]);
7774

7875
const embeddingsFinal = useMemo(() => embeddings.map((embedding) => (
79-
{ ...embedding, onIconNotesClick: openFilterAttributesModal(embedding) }
80-
)), [embeddings]);
76+
{ ...embedding, onIconNotesClick: () => embedding.onQdrant ? dispatch(setModalStates(ModalEnum.FILTERED_ATTRIBUTES, { embeddingId: embedding.id, open: true, attributeNames: prepareAttributeDataByNames(embedding.filterAttributes), showEditOption: showEditOption })) : null }
77+
)), [embeddings, showEditOption]);
8178

8279
return (<div className="mt-8">
8380
<div className="text-lg leading-6 text-gray-900 font-medium inline-block w-full">

src/components/projects/projectId/settings/labeling-tasks/LabelingTasks.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ export default function LabelingTasks() {
8888
return prepareNewArray;
8989
}
9090

91-
const deleteLabelingTask = useCallback((task) => () => dispatch(setModalStates(ModalEnum.DELETE_LABELING_TASK, { taskId: task.id, open: true })), [])
92-
9391
const deleteLabel = useCallback((task: LabelingTask, label: LabelType) => () => {
9492
dispatch(setModalStates(ModalEnum.DELETE_LABEL, { taskId: task.id, label: label, open: true }));
9593
}, []);
@@ -103,7 +101,7 @@ export default function LabelingTasks() {
103101
return labelingTasksSchema.map((labelingTask) => (
104102
{
105103
...labelingTask,
106-
onDelete: deleteLabelingTask(labelingTask),
104+
onDelete: () => dispatch(setModalStates(ModalEnum.DELETE_LABELING_TASK, { taskId: labelingTask.id, open: true })),
107105
labels: labelingTask.labels.map((label) => ({ ...label, onDelete: deleteLabel(labelingTask, label), onChangeColor: changeColorLabel(labelingTask, label) })),
108106
}
109107
))

0 commit comments

Comments
 (0)