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

Do Not Account for Async Rendering of Properties Panel #186

Merged
merged 2 commits into from
Sep 20, 2022
Merged

Conversation

philippfromme
Copy link
Contributor

@philippfromme philippfromme commented Sep 19, 2022

Context

Due to the async rendering of React applications subscribing to events within a component isn't reliable as the event might already have been fired when the component is rendered and subscribes. As discussed with @nikku events should be subscribed to outside of the React application and relevant information should be passed to the application through props.

Sketch

function renderApp(props) {
  render(<App {...props} />, document.getElementById("root"));
}

eventBus.on('selection.changed', ({ newSelection }) => renderApp({ element: getElement(newSelection) });

eventBus.on('propertiesPanel.showEntry', ({ id }) => renderApp({ showEntry: id });

This requires a bigger implementation effort. In the meantime, to fix this issue, the following changes have been made:

  • remove useEventBuffer hook
  • use useEffect instead of useLayoutEffect

These changes remove some of the magic 🧙🏻‍♂️ that was added to work around the issue described above. The async rendering will be accounted for by camunda/linting#19.


Related to camunda/camunda-modeler#3144

@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Sep 19, 2022
@philippfromme philippfromme changed the title Do Not Account For Async Rendering Do Not Account for Async Rendering of Properties Panel Sep 19, 2022
Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less 🪄, yes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants