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

feat(group): make inital open state configurable #139

Merged
merged 2 commits into from
Mar 24, 2022

Conversation

marstamm
Copy link
Contributor

@marstamm marstamm commented Mar 22, 2022

related to bpmn-io/bpmn-js-properties-panel#618

for integration PR in bpmn-js properties panel, see bpmn-io/bpmn-js-properties-panel#621

@marstamm marstamm self-assigned this Mar 22, 2022
@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Mar 22, 2022
@marstamm marstamm force-pushed the 618-element-template-sections branch from 36579d3 to ca634c7 Compare March 22, 2022 15:10
@marstamm marstamm marked this pull request as ready for review March 22, 2022 15:31
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Mar 22, 2022
@marstamm
Copy link
Contributor Author

Ready for review. I also adjusted the downstream integration: bpmn-io/bpmn-js-properties-panel#621

Copy link
Contributor

@pinussilvestrus pinussilvestrus left a comment

Choose a reason for hiding this comment

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

Looks good in general, makes sense to make it possible to set the initial state from a parent component. 👍

Just for my understanding: did we consider building it via the useEvent API we recently introduced? So to make it also possible to open groups from elsewhere? /cc @philippfromme

Probably that's a different use case because this open state should also be persisted, right?

@@ -5,7 +5,7 @@ import {
const LayoutContext = createContext({
layout: {},
setLayout: () => {},
getLayoutForKey: () => {},
getLayoutForKey: (key, defaultValue) => defaultValue,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to be that explicit at this stage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, we can mock it in the tests instead. I went ahead and did that

@marstamm
Copy link
Contributor Author

Just for my understanding: did we consider building it via the useEvent API #137? So to make it also possible to open groups from elsewhere?

I did consider going this way. However, the use case is slightly different and not as clean as solving it via props. E.g., we would always have to fire the event right after rendering while also checking that the state is persisted. Also, the current API only supports elements and not groups.

In the end, I decided to go with shouldOpen, as we also have those 2 options side-by-side in the ListGroup component:

@marstamm marstamm force-pushed the 618-element-template-sections branch from 9f8b1e4 to 2c242ac Compare March 24, 2022 08:35
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.

I like the way this is going + agree to #139 (comment).

@pinussilvestrus Please give your 👍 to confirm implementation.

Copy link
Contributor

@pinussilvestrus pinussilvestrus left a comment

Choose a reason for hiding this comment

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

Thanks for the clarification 👏 I agree 🙂

@marstamm marstamm merged commit 7e3685d into main Mar 24, 2022
@marstamm marstamm deleted the 618-element-template-sections branch March 24, 2022 10:13
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants