Fix: state not reseting properly
This commit is contained in:
parent
983e03d714
commit
75fa7c147b
2 changed files with 11 additions and 2 deletions
|
|
@ -34,10 +34,9 @@ import useUpdateValidationStatus from "../hooks/use-update-validation-status";
|
|||
import useValidationStatusString from "../hooks/use-validation-status-string";
|
||||
import getFieldTitle from "../utils/get-field-title";
|
||||
import sortFields from "../utils/sort-fields";
|
||||
import isWrappedWithClass from "../../pages/FlowPage/components/PageComponent/utils/is-wrapped-with-class";
|
||||
import ParameterComponent from "./components/parameterComponent";
|
||||
import { postCustomComponent } from "../../controllers/API";
|
||||
import { cloneDeep } from "lodash";
|
||||
import { useShortcutsStore } from "../../stores/shortcuts";
|
||||
|
||||
export default function GenericNode({
|
||||
data,
|
||||
|
|
@ -234,6 +233,8 @@ export default function GenericNode({
|
|||
}
|
||||
};
|
||||
|
||||
const shortcuts = useShortcutsStore((state) => state.shortcuts);
|
||||
|
||||
const memoizedNodeToolbarComponent = useMemo(() => {
|
||||
return (
|
||||
<NodeToolbar>
|
||||
|
|
@ -271,6 +272,7 @@ export default function GenericNode({
|
|||
updateNodeCode,
|
||||
isOutdated,
|
||||
selected,
|
||||
shortcuts,
|
||||
// openWDoubleCLick,
|
||||
// setOpenWDoubleCLick,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -40,9 +40,16 @@ export default function ShortcutsPage() {
|
|||
|
||||
const combinationToEdit = shortcuts.filter((s) => s.name === selectedRows[0]);
|
||||
const [open, setOpen] = useState(false);
|
||||
const updateUniqueShortcut = useShortcutsStore(
|
||||
(state) => state.updateUniqueShortcut,
|
||||
);
|
||||
|
||||
function handleRestore() {
|
||||
setShortcuts(defaultShortcuts);
|
||||
defaultShortcuts.forEach(({ name, shortcut }) => {
|
||||
const fixedName = name.split(" ")[0].toLowerCase();
|
||||
updateUniqueShortcut(fixedName, shortcut);
|
||||
});
|
||||
localStorage.removeItem("langflow-shortcuts");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue