Skip to content
Snippets Groups Projects
Commit 0e0c1381 authored by Maximilian Giller's avatar Maximilian Giller :squid:
Browse files

Fixed change trigger calling too often

parent 88b4b432
No related branches found
No related tags found
No related merge requests found
Pipeline #57133 passed
import React from "react";
import React, { useState } from "react";
import { DescriptiveReference } from "../../common/graph/node";
import "./nodetypeentry.css";
......@@ -13,15 +13,28 @@ function ReferenceEntry({
onReferenceDelete,
onReferenceChange,
}: ReferenceEntryProps) {
const [change, setChange] = useState(false);
const onPropChange = (
prop: keyof DescriptiveReference,
newValue: string
) => {
reference[prop] = newValue;
setChange(true);
};
const handleOnBlur = () => {
// Did anything change?
if (!change) {
return;
}
onReferenceChange(reference);
setChange(false);
};
return (
<div className="reference" onBlur={() => onReferenceChange(reference)}>
<div className="reference" onBlur={handleOnBlur}>
<label htmlFor="reference-url">Url</label>
<br />
<input
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment