Skip to content

fix(flow-client): loading state muting based on trigger events#24230

Open
platosha wants to merge 4 commits intomainfrom
fix/consistent-connection-state
Open

fix(flow-client): loading state muting based on trigger events#24230
platosha wants to merge 4 commits intomainfrom
fix/consistent-connection-state

Conversation

@platosha
Copy link
Copy Markdown
Contributor

Fixes #24075

This change reverts the eager removal of loading state introduced by #23229, as it causes the indication to disappear during ongoing loading. As a replacement, it re-introduces debouncing tracking of active requests, and adds event-based silencing of the loading indication to avoid flashing the indicator for high-frequency UI interactions.

In addition, instead of setting loading state using ConnectionState.setState() directly, the proper connection state methods (loadingStarted(), loadingFinished()) are used to avoid interference with loading state for requests from other sources outside Flow client.

Fixes #24075

This change reverts the eager removal of loading state introduced by #23229, as it causes the indication to disappear during ongoing loading. As a replacement, it re-introduces debouncing tracking of active requests, and adds event-based silencing of the loading indication to avoid flashing the indicator for high-frequency UI interactions.

In addition, instead of setting loading state using `ConnectionState.setState()` directly, the proper connection state methods (`loadingStarted()`, `loadingFinished()`) are used to avoid interference with loading state for requests from other sources outside Flow client.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

Test Results

 1 404 files  ±0   1 404 suites  ±0   1h 16m 13s ⏱️ + 2m 19s
10 133 tests +6  10 063 ✅ +6  70 💤 ±0  0 ❌ ±0 
10 608 runs  +6  10 529 ✅ +6  79 💤 ±0  0 ❌ ±0 

Results for commit 376b93e. ± Comparison against base commit ba49acd.

♻️ This comment has been updated with latest results.

@mshabarov mshabarov requested a review from mcollovati May 4, 2026 11:44
@github-actions github-actions Bot added +1.0.0 and removed +0.0.1 labels May 6, 2026
@github-actions github-actions Bot added +0.0.1 and removed +1.0.0 labels May 6, 2026
@platosha platosha marked this pull request as ready for review May 6, 2026 10:58
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

+ pushPendingMessage.toJson());
JsonObject payload = pushPendingMessage;
pushPendingMessage = null;
registry.getRequestResponseTracker().startRequest();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you explain why the call to startRequest() can be removed?
Same in the send method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Having multiple calls to startRequest() on different branches of message sending code path is needlessly complex and confusing.

The sendPayload(final JsonObject payload) actually already takes care of calling startRequest() itself just before actually sending any message, regardless of the transport (XHR or push). This makes it an ideal single place candidate to keep for me.

In this instance, the sendPayload(payload) invoked below also call startRequest() if that was not done already, therefore making the call here is probably unnecessary.

In the send() case, one of the branches on the code path ends up calling startRequest() and then queueing the message for later instead of actually sending it with sendPayload(payload), which seems just inaccurate to me. Again, in that case, the queued message will get sent eventually through the sendPayload(payload) method, and during that time the startRequest() will be called by sendPayload(payload) itself.

Now that the code path is cleaned up a bit, it would rather make sense to me to remove if guarding against the “another request active” exception around startRequest() in sendPayload(payload), which feels like something added earlier to aid with multiple and sometimes missed startRequest() calls in various code path branches. Would that make sense?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Probably it can be removed, but I have some concerns about the "reconnect" path.

Copy link
Copy Markdown
Collaborator

@mcollovati mcollovati left a comment

Choose a reason for hiding this comment

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

I did some tests locally and it seems to work fine. However, it is a bit challenging to properly reproduce the issue.
Do you think it would be possible to add some integration test for this? I guess it's not that easy.

public void processMessage(String rpcType, String eventType) {
// Require at least one non-silent message to indicate loading for
// the next request.
boolean silent = JsonConstants.RPC_EVENT_TYPE.equals(rpcType)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't it be RPC_TYPE_EVENT? The constants have the same "event" value, but RPC_EVENT_TYPE seems incorrect here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Since 25.1.0 Missing Loading indicator on route changing

2 participants