Skip to content

fix: set loading state to false when query channel errors out#1585

Merged
khushal87 merged 7 commits intomasterfrom
fix/loading-state-in-channel-manager
Jul 30, 2025
Merged

fix: set loading state to false when query channel errors out#1585
khushal87 merged 7 commits intomasterfrom
fix/loading-state-in-channel-manager

Conversation

@khushal87
Copy link
Member

@khushal87 khushal87 commented Jul 29, 2025

The PR focuses on the following:

  1. Set the loading state to false if the query channel API errors out. This was essential as currently the channel loads infinitely.
  2. Manage the query channels error state for offline support enabled properly.
  3. When the sync API returns an response timeout error from the BE or from Axios we should not clear/reset the DB. Doing it was resulting in empty channel list even if the data should be there in the DB. This happened because we just cleared the DB.

Closes #1584 GetStream/stream-chat-react-native#3180

@github-actions
Copy link
Contributor

github-actions bot commented Jul 29, 2025

Size Change: +406 B (+0.09%)

Total Size: 442 kB

Filename Size Change
dist/cjs/index.browser.cjs 128 kB +134 B (+0.1%)
dist/cjs/index.node.cjs 173 kB +135 B (+0.08%)
dist/esm/index.js 141 kB +137 B (+0.1%)

compressed-size-action

Copy link
Contributor

@isekovanic isekovanic left a comment

Choose a reason for hiding this comment

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

Looks good to me ! Please write tests for this

expect(upsertUserSyncStatusSpy).toHaveBeenCalled();
});

it('do not resets DB if sync API throws an AxiosError with request timeout', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

totally not important nitpick

Suggested change
it('do not resets DB if sync API throws an AxiosError with request timeout', async () => {
it('do not reset the DB if the sync API throws an AxiosError with request timeout', async () => {

expect(resetDBSpy).not.toHaveBeenCalled();
expect(upsertUserSyncStatusSpy).not.toHaveBeenCalled();
});

Copy link
Contributor

Choose a reason for hiding this comment

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

In the test just below this one, please add an additional check for the channelManager.state.isLoading value (it should now be false with the recent fixes)

Copy link
Contributor

@isekovanic isekovanic left a comment

Choose a reason for hiding this comment

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

Please add the oneliner check that I mentioned in my comment and then you can feel free to merge this. Thanks !

@khushal87 khushal87 merged commit 11c18f5 into master Jul 30, 2025
4 checks passed
@khushal87 khushal87 deleted the fix/loading-state-in-channel-manager branch July 30, 2025 07:06
github-actions bot pushed a commit that referenced this pull request Jul 30, 2025
## [9.13.0](v9.12.0...v9.13.0) (2025-07-30)

### Bug Fixes

* set loading state to [secure] when query channel errors out ([#1585](#1585)) ([11c18f5](11c18f5)), closes [#1584](#1584)

### Features

* add get hook event list ([#1586](#1586)) ([40f1f92](40f1f92))
@stream-ci-bot
Copy link

🎉 This PR is included in version 9.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

Remove loading status when failed max number of retries on queryChannels

3 participants