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

Disabled channels are not removed from persistence client #2036

Open
1 task done
TheAppCrafter opened this issue Oct 19, 2024 · 6 comments
Open
1 task done

Disabled channels are not removed from persistence client #2036

TheAppCrafter opened this issue Oct 19, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@TheAppCrafter
Copy link

Which packages are you using?

stream_chat_flutter, stream_chat_persistance

On what platforms did you experience the issue?

iOS

What version are you using?

stream_chat_flutter - 8.0.0
stream_chat_persistencee - 8.0.0

What happened?

When channels are disabled using a server side sdk the channels on the client are not removed from the persistence client. When offline the disabled channels still show in the channel list. When the user is online and the channel list is refreshed this also leads to the disabled channels showing momentarily.

This issue is similar to these previous issues:

  1. Pull to refresh shows removed channels #1585
  2. Pull to refresh channel list shown removed channel #732

Steps to reproduce

1. Disable channel server side ie. with python: 
channel.update_partial(to_set={"disabled": True})
2. If online, refresh channel list and disabled channels show momentarily 
3. If offline, channel list shows disabled channels

Supporting info to reproduce

No response

Relevant log output

No response

Flutter analyze output

No response

Flutter doctor output

[✓] Flutter (Channel stable, 3.24.1, on macOS 14.5 23F79 darwin-arm64, locale
    en-US)
    • Flutter version 3.24.1 on channel stable at
      /Users/Austin/fvm/versions/3.24.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5874a72aa4 (8 weeks ago), 2024-08-20 16:46:00 -0500
    • Engine revision c9b9d5780d
    • Dart version 3.5.1
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/Austin/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode 15.4.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.94.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (5 available)
    • Austin’s iPhone (mobile)        • 00008101-001915960C00001E            •
      ios            • iOS 17.6.1 21G93
    • iPhone 15 Pro Max (mobile)      • A6295725-FE9C-4177-BD01-73B2979C243D •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                 • macos                                •
      darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                •
      darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                               •
      web-javascript • Google Chrome 129.0.6668.101

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Code of Conduct

  • I agree to follow this project's Code of Conduct
@TheAppCrafter TheAppCrafter added the bug Something isn't working label Oct 19, 2024
Copy link

github-actions bot commented Nov 8, 2024

This issue is stale because it has been open for 20 days with no activity.

@github-actions github-actions bot added the Stale label Nov 8, 2024
@szechyjs
Copy link

szechyjs commented Nov 8, 2024

I see the same thing, but not necessarily from disabled channels, but deleted channels. When the app first loads, the channels get loaded from offline persistence and shows a bunch of channels that have been removed, once it syncs with api, the channels all get removed. However, every app start/load still shows these deleted channels. As noted above this creates a brief moment where a user sees an inaccurate channel list.

@github-actions github-actions bot removed the Stale label Nov 8, 2024
Copy link

This issue is stale because it has been open for 20 days with no activity.

@github-actions github-actions bot added the Stale label Nov 28, 2024
@szechyjs
Copy link

not stale

@github-actions github-actions bot removed the Stale label Nov 29, 2024
@TheAppCrafter
Copy link
Author

I got around this issue by customizing the StreamMessageSearchListController and StreamChannelListController filter in my channel list widget.

For example:

final _filter = stream_chat.Filter.and([
  stream_chat.Filter.equal('type', 'messaging'),
  stream_chat.Filter.in_('members', memberList),
  stream_chat.Filter.equal('disabled', false),
]);

 _channelListController = widget.streamChannelListController ?? StreamChannelListController(
  client: _client,
  filter: _filter,
  presence: true,
  limit: _limit
);

_channelListController = widget.streamChannelListController ?? StreamChannelListController(
  client: _client,
  filter: _filter,
  presence: true,
  limit: _limit
);

This filter filters out all disabled channels. I'm sure this can be done for deleted channels as well.

@jensengar
Copy link

I also ran into this issue. Reaching into the chat client and dumping the cache seems to fix it for me. When I delete a channel I do this:

      if (_client.chatPersistenceClient != null) {
        var c = _client;
        await c.chatPersistenceClient!.disconnect(flush: true);
        await c.chatPersistenceClient!.connect(c.state.currentUser!.id);
      }

That seems to be a workaround for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants