diff --git a/rsconcept/frontend/src/components/select/SelectWordForm.tsx b/rsconcept/frontend/src/components/select/SelectWordForm.tsx
index e7129968..6e0f79bb 100644
--- a/rsconcept/frontend/src/components/select/SelectWordForm.tsx
+++ b/rsconcept/frontend/src/components/select/SelectWordForm.tsx
@@ -1,7 +1,6 @@
'use client';
import clsx from 'clsx';
-import { useCallback } from 'react';
import { CProps } from '@/components/props';
import WordformButton from '@/dialogs/DlgEditReference/WordformButton';
@@ -15,12 +14,9 @@ interface SelectWordFormProps extends CProps.Styling {
}
function SelectWordForm({ value, onChange, className, ...restProps }: SelectWordFormProps) {
- const handleSelect = useCallback(
- (grams: Grammeme[]) => {
- onChange(SelectorGrammemes.filter(({ value }) => grams.includes(value as Grammeme)));
- },
- [onChange]
- );
+ function handleSelect(grams: Grammeme[]) {
+ onChange(SelectorGrammemes.filter(({ value }) => grams.includes(value as Grammeme)));
+ }
return (
diff --git a/rsconcept/frontend/src/components/select/ToolbarGraphSelection.tsx b/rsconcept/frontend/src/components/select/ToolbarGraphSelection.tsx
index ca1c7707..e4ce8fe3 100644
--- a/rsconcept/frontend/src/components/select/ToolbarGraphSelection.tsx
+++ b/rsconcept/frontend/src/components/select/ToolbarGraphSelection.tsx
@@ -1,5 +1,4 @@
import clsx from 'clsx';
-import { useCallback } from 'react';
import {
IconGraphCollapse,
@@ -35,20 +34,14 @@ function ToolbarGraphSelection({
emptySelection,
...restProps
}: ToolbarGraphSelectionProps) {
- const handleSelectCore = useCallback(() => {
+ function handleSelectCore() {
const core = [...graph.nodes.keys()].filter(isCore);
onChange([...core, ...graph.expandInputs(core)]);
- }, [onChange, graph, isCore]);
+ }
- const handleSelectOwned = useCallback(
- () => (isOwned ? onChange([...graph.nodes.keys()].filter(isOwned)) : undefined),
- [onChange, graph, isOwned]
- );
-
- const handleInvertSelection = useCallback(
- () => onChange([...graph.nodes.keys()].filter(item => !selected.includes(item))),
- [onChange, selected, graph]
- );
+ function handleSelectOwned() {
+ if (isOwned) onChange([...graph.nodes.keys()].filter(isOwned));
+ }
return (
@@ -91,7 +84,7 @@ function ToolbarGraphSelection({
}
- onClick={handleInvertSelection}
+ onClick={() => onChange([...graph.nodes.keys()].filter(item => !selected.includes(item)))}
/>
state.noNavigation);
const treeHeight = useFitHeight('4rem + 2px');
- const handleSelectTopic = useCallback(
- (topic: HelpTopic) => {
- menu.hide();
- onChangeTopic(topic);
- },
- [onChangeTopic, menu]
- );
+ function handleSelectTopic(topic: HelpTopic) {
+ menu.hide();
+ onChangeTopic(topic);
+ }
return (
{
+ function handleHide() {
setIsOpen(false);
onHide();
- }, [onHide]);
+ }
useClickedOutside(isOpen, ref, handleHide);
useEffect(() => setIsOpen(true), []);
- const handleOpenSchema = () => {
+ function handleOpenSchema() {
controller.navigateOperationSchema(operation.id);
- };
+ }
- const handleEditSchema = () => {
+ function handleEditSchema() {
handleHide();
onEditSchema(operation.id);
- };
+ }
- const handleEditOperation = () => {
+ function handleEditOperation() {
handleHide();
onEditOperation(operation.id);
- };
+ }
- const handleDeleteOperation = () => {
+ function handleDeleteOperation() {
handleHide();
onDelete(operation.id);
- };
+ }
- const handleCreateSchema = () => {
+ function handleCreateSchema() {
handleHide();
onCreateInput(operation.id);
- };
+ }
- const handleRunSynthesis = () => {
+ function handleRunSynthesis() {
handleHide();
onExecuteOperation(operation.id);
- };
+ }
- const handleRelocateConstituents = () => {
+ function handleRelocateConstituents() {
handleHide();
onRelocateConstituents(operation.id);
- };
+ }
return (
diff --git a/rsconcept/frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx b/rsconcept/frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx
index 7669fdb4..922c74e5 100644
--- a/rsconcept/frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx
+++ b/rsconcept/frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx
@@ -1,7 +1,7 @@
'use client';
import { toPng } from 'html-to-image';
-import { useCallback, useEffect, useState } from 'react';
+import { useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import {
Background,
@@ -65,16 +65,13 @@ function OssFlow() {
const [toggleReset, setToggleReset] = useState(false);
const [menuProps, setMenuProps] = useState
(undefined);
- const onSelectionChange = useCallback(
- ({ nodes }: { nodes: Node[] }) => {
- const ids = nodes.map(node => Number(node.id));
- controller.setSelected(prev => [
- ...prev.filter(nodeID => ids.includes(nodeID)),
- ...ids.filter(nodeID => !prev.includes(Number(nodeID)))
- ]);
- },
- [controller]
- );
+ function onSelectionChange({ nodes }: { nodes: Node[] }) {
+ const ids = nodes.map(node => Number(node.id));
+ controller.setSelected(prev => [
+ ...prev.filter(nodeID => ids.includes(nodeID)),
+ ...ids.filter(nodeID => !prev.includes(Number(nodeID)))
+ ]);
+ }
useOnSelectionChange({
onChange: onSelectionChange
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TGFlow.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TGFlow.tsx
index aee78c1c..cc2bd19d 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TGFlow.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TGFlow.tsx
@@ -79,17 +79,14 @@ function TGFlow() {
const [needReset, setNeedReset] = useState(true);
const [toggleResetView, setToggleResetView] = useState(false);
- const onSelectionChange = useCallback(
- ({ nodes }: { nodes: Node[] }) => {
- const ids = nodes.map(node => Number(node.id));
- if (ids.length === 0) {
- controller.setSelected([]);
- } else {
- controller.setSelected(prev => [...prev.filter(nodeID => !filteredGraph.hasNode(nodeID)), ...ids]);
- }
- },
- [controller, filteredGraph]
- );
+ function onSelectionChange({ nodes }: { nodes: Node[] }) {
+ const ids = nodes.map(node => Number(node.id));
+ if (ids.length === 0) {
+ controller.setSelected([]);
+ } else {
+ controller.setSelected(prev => [...prev.filter(nodeID => !filteredGraph.hasNode(nodeID)), ...ids]);
+ }
+ }
useOnSelectionChange({
onChange: onSelectionChange
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ToolbarFocusedCst.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ToolbarFocusedCst.tsx
index 6a955cf7..a065bb7e 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ToolbarFocusedCst.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/ToolbarFocusedCst.tsx
@@ -1,7 +1,5 @@
'use client';
-import { useCallback } from 'react';
-
import { IconGraphInputs, IconGraphOutputs, IconReset } from '@/components/Icons';
import MiniButton from '@/components/ui/MiniButton';
import { IConstituenta } from '@/models/rsform';
@@ -29,10 +27,10 @@ function ToolbarFocusedCst({
}: ToolbarFocusedCstProps) {
const controller = useRSEdit();
- const resetSelection = useCallback(() => {
+ function resetSelection() {
reset();
controller.setSelected([]);
- }, [reset, controller]);
+ }
return (