Open wiedld opened 2 years ago
First time schema composition is turned on after page load occurs there is a hardcoded 3 second delay to prevent race conditions.
This hard-coded three seconds is mostly a guess, and on systems with slower cpus or slower connections, this is still likely to break. The solution could be to raise that limit to 5 seconds, but where does it end? 10 seconds? 30 seconds?
One of the things react et al gives us is otherwise a more straightforward API for managing state, and allowing components to update and change based on state (via javascript's event-based model). In this situation, what we're missing is a state that says "we're ready for composition to be turned on." Composition shouldn't be "turned on" until it can be turned on in the place where it matters.
Race conditions can occur when a user clicks too many elements within Schema Browser too quickly.
In this case, it's because we're again assuming that we don't have state/change events that allow us to see when changes are applied. It is the UI component's responsibility to handle input too quick (we debounce in text boxes, for instance). There are a number of ways we can hack around this, but the most straightforward way is likely to add a new composition criteria and not allow anymore composition criteria to be added until the query itself changes (likely by checking that the change gets updated in QueryContext
, but I'm still trying to get my head around all the places where the query is stored.
Any general error occurring within the LSP will desynchronize it from the UI.
This happens as a side effect anywhere where the wasm is used. Its solutions are likely unrelated to composition, and shouldn't be addressed with the narrow view of composition. It warrants its own Epic for how we handle this going forward.
“Flux Sync’ is a One Time One way process.
Is this actually an issue, or is this a feature goal? If it's just an unimplemented feature, is it scope creep, or is it original functionality we're missing?
“Flux Sync’ is a One Time One way process.
Per product, this is not something we need to worry about currently.
Spoke with @rockstar about the general theme of wanting to move the editor-LSP wiring into an eventing based model. The crux of the issue is that we don't have control over when certain events occur in the monacoEditor-LSP communication, nor do we currently have transparency into when these events have completed.
A bit of background. The monacoEditor-LSP communication is a series of request/response messages, corresponding to events. Events must occur in sequence, e.g. (1) initialize request/response, (2) initialized request/response, (3) file didOpen request/response, and finally (4) any other messages (include schema composition messages). We have a series of async issues that arise due to need to have all these request/response messages occur in sequence, as well as (in some cases) having the monacoEditor fully "complete the event" triggered by the previous request/response message -- before the UI sends the next request.
We have been getting around this issue in the current implementation, by using message buffering and a facade design pattern. This adds code complexity which we would ideally like to remove prior to piling on more features. However, it does require that we add the missing event handlers to the monacoEditor API.
.
Here are the current async events, how we are currently handling them, and how we propose to handle them under the eventing-based model:
the LSP worker boot time is longer than the monacoEditor boot time.
the UI, outside the monacoEditor, can send request messages to the LSP. But these messages can only be acting upon (without error), when done in the proper async sequence.
didOpen
event has completed.didOpen()
event listener, after which we can send out the composition requests.Have all events only be triggered through the monaco-editor.
Handling of LSP error messages:
Reconsider/address decisions made with initial PoC. Decide which is feasible, and the timeline:
Small items that we can quickly resolve: