Validation Markers 'Could not retrieve element with id' (glsp-node-server/glsp-vscode-integration) #1724
Replies: 2 comments 1 reply
|
@martin-fleck-at Could you please have a look at this? |
|
Hi Jonathan, Before I go into any detail, a few questions, because I am not yet sure that what I found is really what you are running into.
The reason I am asking is the following. Validation markers are pure client-side feedback. A A So as far as I can tell, a marker id should only be able to reach the server if bounds data from one hidden rendering leaks into the next one, which is something we fixed only recently in eclipse-glsp/glsp-client#525 for #1717. Until that fix, the collected bounds were only cleared on the path that actually sends them, so anything that skipped that path left them behind for the next run. There are two ways that can happen. The first one is a hidden rendering that is not a bounds request at all, which today means an export, and that is the case the issue was originally about. The second one is a bounds pass that fails somewhere in between, and that one is more interesting for you, because a If you are on 2.7.0 or older, the quickest check is probably to try @injectable()
export class MyHiddenBoundsUpdater extends GLSPHiddenBoundsUpdater {
override postUpdate(cause?: Action): void {
try {
super.postUpdate(cause);
} finally {
// backport of https://github.com/eclipse-glsp/glsp-client/pull/525
this.getElement2BoundsData().clear();
this.element2route = [];
this.root = undefined;
}
}
}
// in your diagram module
rebind(GLSPHiddenBoundsUpdater).to(MyHiddenBoundsUpdater).inSingletonScope();Independently of that leak, it probably makes sense for you to keep the marker bounds away from the server entirely, since the server has no use for them anyway. @injectable()
export class MyHiddenBoundsUpdater extends GLSPHiddenBoundsUpdater {
override postUpdate(cause?: Action): void {
if (ServerAction.is(cause)) {
const data = this.getElement2BoundsData();
data.forEach((_boundsData, element) => element instanceof GIssueMarker && data.delete(element));
}
super.postUpdate(cause);
}
}Local bounds requests stay untouched that way, so the marker placement keeps working as before. I think something along these lines is probably what we should do in the framework itself. On your last question, adding the markers in the GNode.builder()
.id(nodeId)
.addChildren(GIssueMarker.builder().id(`${nodeId}_marker`).addIssue('Task name must be unique', 'error').build())
.build();The client already registers that type with the Depending on what you find out, I would probably like to open an issue to filter client-only decorations from the bounds we send to the server and to make Cheers, |
Uh oh!
There was an error while loading. Please reload this page.
Hey there,
We've implemented live validation based on AbstractModelValidator.
Running into an issue where if we edit a diagram where one or more nodes have validation markers, and then make some combination of editing/saving/undoing in the diagram we get a 'Could not retrieve element with id' error.
It took me a while but because the IDs are not 32 character hashes like we use for the rest of the diagram elements I realized that it seems to be the validation marker element that is failing to be retrieved, when the ComputedBoundsHandler is triggered.
These elements are never added to the GModelIndex, which makes sense as they are created by the validation action and then added on as feedback. I'm assuming they usually get cleared at some point and should never make it as far as this.
Would you be able to clarify how this is supposed to work by default? We've done a bunch of changes to loading and saving to work with our integration between GLSP and Langium so it's very likely we've done something that has resulted in this issue.
I'm also wondering if it's possible to just add the IssueMarkers from the GModelFactory (and it still display in the same way)? Our validations come from the Langium side anyway and we refresh the diagram when the document changes, so it might make sense for us to remove these from the live validation altogether.
Cheers!
Jonathan
All reactions