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

Support request / response scheme #8

Closed
spoenemann opened this issue Oct 30, 2018 · 2 comments · Fixed by #103
Closed

Support request / response scheme #8

spoenemann opened this issue Oct 30, 2018 · 2 comments · Fixed by #103
Labels
discussion Should be figured out together
Milestone

Comments

@spoenemann
Copy link
Contributor

From theia-ide/sprotty#218:

We have several actions that appear in request / response pairs:

  • RequestModelAction / SetModelAction
  • RequestPopupModelAction / SetPopupModelAction
  • RequestBoundsAction / SetBoundsAction
  • RequestExportSvgAction / ExportSvgAction

We should add a mechanism that allows to match a response to a corresponding request. This is necessary in case multiple actions of the same kind are fired at the same time.

@spoenemann spoenemann added the discussion Should be figured out together label May 7, 2019
@spoenemann spoenemann pinned this issue Aug 22, 2019
@JanKoehnlein
Copy link
Contributor

Some thought and results of internal discussions:

  • This is of course similar to notifications vs requests in JSON-RPC.
  • We have to match requests with their responses.
  • Question: Should the ActionDispatcher block (defer incoming actions) as it waits for a response? We have already a simple blocking mechanism in the ActionDispatcher that should be revised as well.
  • We should not cut the API such that a promise can be awaited where actions are dispatched, as this happens usually within a transaction. Continuing the control flow when the promise resolves but after the transaction has already finished should be avoided.
  • A common case is that I want to dispatch a CenterAction after some action causing a model change. Due to the model change, we're likely to produce RequestBounds, ComputedBounds or even LayoutActions that have to be executed before the CenterAction.
  • What happens to actions that cause a change of the DOM? Should their promise resolve before the deferred rendering has happened? Likely not.

@spoenemann
Copy link
Contributor Author

This might help for solving #85: implement "model inspection" requests such as GetSelectionAction, which results in a matching response that contains the currently selected model element ids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Should be figured out together
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants