Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix data marker update #293

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 19 additions & 13 deletions src/components/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,31 @@ export default function Group(props) {

// set edited state depending on all entries
useEffect(() => {
const hasOneEditedEntry = entries.find(entry => {
const {
id,
isEdited
} = entry;

const entryNode = domQuery(`[data-entry-id="${id}"]`);
// TODO(@barmac): replace with CSS when `:has()` is supported in all major browsers, or rewrite as in https://github.com/camunda/camunda-modeler/issues/3815#issuecomment-1733038161
const scheduled = requestAnimationFrame(() => {
barmac marked this conversation as resolved.
Show resolved Hide resolved
const hasOneEditedEntry = entries.find(entry => {
const {
id,
isEdited
} = entry;

if (!isFunction(isEdited) || !entryNode) {
return false;
}
const entryNode = domQuery(`[data-entry-id="${id}"]`);

const inputNode = domQuery('.bio-properties-panel-input', entryNode);
if (!isFunction(isEdited) || !entryNode) {
return false;
}

const inputNode = domQuery('.bio-properties-panel-input', entryNode);

return isEdited(inputNode);
});

return isEdited(inputNode);
setEdited(hasOneEditedEntry);
});

setEdited(hasOneEditedEntry);
}, [ entries ]);
return () => cancelAnimationFrame(scheduled);
}, [ entries, setEdited ]);

// set error state depending on all entries
const allErrors = useErrors();
Expand Down
8 changes: 8 additions & 0 deletions test/spec/components/Group.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ describe('<Group>', function() {
container = TestContainer.get(this);
});

beforeEach(() => {
sinon.replace(window, 'requestAnimationFrame', cb => cb());
});

afterEach(() => {
sinon.restore();
});

barmac marked this conversation as resolved.
Show resolved Hide resolved

it('should render', function() {

Expand Down
Loading