-
Notifications
You must be signed in to change notification settings - Fork 57
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
[3533] Add a dedicated component to handle diagram subscription #3534
base: master
Are you sure you want to change the base?
Conversation
b01d258
to
2d24efe
Compare
@@ -42,10 +45,13 @@ public EditingContextDispatcher(IEditingContextEventProcessorRegistry editingCon | |||
|
|||
@Override | |||
public Mono<IPayload> dispatchQuery(String editingContextId, IInput input) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about asking for a new IDiagramEventProcessor here but I was not able to do it in the editingContextEventProcessor without bringing cyclic dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not put the modification on the new architecture on purpose, I wanted to know if it's okay to create the IDiagramEventProcessor just after the invoking the datafetcher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend changes should be done in a separate commit, before the one for the frontend (in order to detect changes in the behavior of the code more easily). We should simplify the code of the management of the representation event processors, for that we should start with IRepresentationEventProcessorFactory
to change it to this:
public interface IRepresentationEventProcessorFactory {
boolean canHandle(IRepresentationConfiguration configuration);
Optional<IRepresentationEventProcessor> createRepresentationEventProcessor(IRepresentationConfiguration configuration,
IEditingContext editingContext);
}
This way, we don't need the representationEventProcessorClass
anymore. You can thus remove it from all the representation event processor factories, it should not have an impact since all the factory are using the configuration to find out if they should do their job or not. By removing this class argument from the factory and the composed factory (IRepresentationEventProcessorComposedFactory
), you can also remove this requirement from EditingContextEventProcessor#acquireRepresentationEventProcessor
, IEventProcessorSubscriptionProvider#getSubscription
and all the subscription data fetchers.
Once this is done, we will need to simplify the usage of the IRepresentationConfiguration
, this will be a bit more tricky. We will probably have to merge things one by one. But first, you will have to remove this class argument otherwise you can't know how to subscribe to a representation using only its identifier.
packages/diagrams/frontend/sirius-components-diagrams/src/renderer/DiagramRenderer.tsx
Outdated
Show resolved
Hide resolved
packages/diagrams/frontend/sirius-components-diagrams/src/renderer/DiagramRenderer.tsx
Outdated
Show resolved
Hide resolved
packages/diagrams/frontend/sirius-components-diagrams/src/renderer/DiagramRenderer.tsx
Outdated
Show resolved
Hide resolved
...ages/diagrams/frontend/sirius-components-diagrams/src/renderer/adjust-size/useAdjustSize.tsx
Outdated
Show resolved
Hide resolved
packages/diagrams/frontend/sirius-components-diagrams/src/renderer/layout/useArrangeAll.ts
Outdated
Show resolved
Hide resolved
...es/diagrams/frontend/sirius-components-diagrams/src/renderer/layout/useDistributeElements.ts
Outdated
Show resolved
Hide resolved
...es/diagrams/frontend/sirius-components-diagrams/src/representation/DiagramRepresentation.tsx
Outdated
Show resolved
Hide resolved
...agrams/frontend/sirius-components-diagrams/src/representation/DiagramSubscriptionContext.tsx
Outdated
Show resolved
Hide resolved
@@ -42,10 +45,13 @@ public EditingContextDispatcher(IEditingContextEventProcessorRegistry editingCon | |||
|
|||
@Override | |||
public Mono<IPayload> dispatchQuery(String editingContextId, IInput input) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend changes should be done in a separate commit, before the one for the frontend (in order to detect changes in the behavior of the code more easily). We should simplify the code of the management of the representation event processors, for that we should start with IRepresentationEventProcessorFactory
to change it to this:
public interface IRepresentationEventProcessorFactory {
boolean canHandle(IRepresentationConfiguration configuration);
Optional<IRepresentationEventProcessor> createRepresentationEventProcessor(IRepresentationConfiguration configuration,
IEditingContext editingContext);
}
This way, we don't need the representationEventProcessorClass
anymore. You can thus remove it from all the representation event processor factories, it should not have an impact since all the factory are using the configuration to find out if they should do their job or not. By removing this class argument from the factory and the composed factory (IRepresentationEventProcessorComposedFactory
), you can also remove this requirement from EditingContextEventProcessor#acquireRepresentationEventProcessor
, IEventProcessorSubscriptionProvider#getSubscription
and all the subscription data fetchers.
Once this is done, we will need to simplify the usage of the IRepresentationConfiguration
, this will be a bit more tricky. We will probably have to merge things one by one. But first, you will have to remove this class argument otherwise you can't know how to subscribe to a representation using only its identifier.
0d434c4
to
cd84581
Compare
523def1
to
e9bb2df
Compare
9d23f4b
to
b625582
Compare
b625582
to
de0cf0b
Compare
8090639
to
18964c6
Compare
77720f6
to
17861dd
Compare
Bug: #3533 Signed-off-by: Michaël Charfadi <[email protected]>
17861dd
to
4913876
Compare
Bug: #3533
Pull request template
General purpose
What is the main goal of this pull request?
Project management
priority:
andpr:
labels been added to the pull request? (In case of doubt, start with the labelspriority: low
andpr: to review later
)area:
,difficulty:
,type:
)CHANGELOG.adoc
been updated to reference the relevant issues?CHANGELOG.adoc
? (Including changes in the GraphQL API)CHANGELOG.adoc
? For example indoc/screenshots/2022.5.0-my-new-feature.png
Architectural decision records (ADR)
[doc]
?CHANGELOG.adoc
?Dependencies
CHANGELOG.adoc
?CHANGELOG.adoc
?Frontend
This section is not relevant if your contribution does not come with changes to the frontend.
General purpose
Typing
We need to improve the typing of our code, as such, we require every contribution to come with proper TypeScript typing for both changes contributing new files and those modifying existing files.
Please ensure that the following statements are true for each file created or modified (this may require you to improve code outside of your contribution).
useMutation<DATA_TYPE, VARIABLE_TYPE>(…)
useQuery<DATA_TYPE, VARIABLE_TYPE>(…)
useSubscription<DATA_TYPE, VARIABLE_TYPE>(…)
useMachine<CONTEXT_TYPE, EVENTS_TYPE>(…)
useState<STATE_TYPE>(…)
?.
(if the GraphQL API specifies that a field cannot benull
, do not treat it has potentiallynull
for example)let diagram: Diagram | null = null;
)Backend
This section is not relevant if your contribution does not come with changes to the backend.
General purpose
Architecture
Review
How to test this PR?
Please describe here the various use cases to test this pull request