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

[Bug] After /mute command and reload cannot access any channel #1046

Closed
1 task done
geweald opened this issue Mar 30, 2022 · 2 comments · Fixed by #1048
Closed
1 task done

[Bug] After /mute command and reload cannot access any channel #1046

geweald opened this issue Mar 30, 2022 · 2 comments · Fixed by #1048
Assignees
Labels
bug Something isn't working

Comments

@geweald
Copy link
Contributor

geweald commented Mar 30, 2022

Which packages are you using?

stream_chat_flutter, stream_chat_persistance

On what platforms did you experience the issue?

iOS, Android, Web

What version are you using?

Latest

What happened?

After muting an user and reloading the app:

In stream_chat-3.5.1/lib/src/core/models/mute.g.dart (this exception cannot be caught outside of the library)

image

Steps to reproduce

1. Open channel
2. Use `/mute @user` (mute an user)
3. Refresh/restart the app, the channel or any other channel will never load because of the exception when fetching user data probably

Supporting info to reproduce

No response

Relevant log output

No response

Flutter analyze output

No response

Flutter doctor output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@geweald geweald added the bug Something isn't working label Mar 30, 2022
@geiszla
Copy link

geiszla commented Mar 30, 2022

We have the same issue for some users. They get the following error when we call streamChatClient.connectUser(...).

I/flutter (28801): 2022-03-30 13:59:03.287894 ⚠️ 🔌 Error parsing an event: NoSuchMethodError: The method 'forEach' was called on null.
I/flutter (28801): Receiver: null
I/flutter (28801): Tried calling: forEach(Closure: (dynamic, dynamic) => void)
I/flutter (28801): 2022-03-30 13:59:03.292658 ⚠️ 🔌 Stack trace: #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
I/flutter (28801): #1      new LinkedHashMap.from (dart:collection/linked_hash_map.dart:186:11)
I/flutter (28801): #2      Serializer.moveToExtraDataFromRoot
package:stream_chat/…/util/serializer.dart:15
I/flutter (28801): #3      new ChannelModel.fromJson
package:stream_chat/…/models/channel_model.dart:41
I/flutter (28801): #4      _$MuteFromJson
package:stream_chat/…/models/mute.g.dart:11
I/flutter (28801): #5      new Mute.fromJson
package:stream_chat/…/models/mute.dart:20
I/flutter (28801): #6      _$OwnUserFromJson.<anonymous closure>
package:stream_chat/…/models/own_user.g.dart:15
I/flutter (28801): #7      MappedListIterable.elementAt (dart:_internal/iterable.dart:413:31)
I/flutter (28801): #8      ListIterator.moveNext (dart:_internal/iterable.dart:342:26)

I believe it's because the json["me"]["mutes"][0] object on the health.check message doesn't contain a channel property and the parser just casts it to Map<String, dynamic> (so doesn't check its actual type) in lib/src/core/models/mute.g.dart:11, then a forEach is called on it afterwards.

Is there any workaround for this other than unmuting the muted channels? It affects a considerable number of our users, who can't use the chat at all this way.

@xsahil03x xsahil03x self-assigned this Mar 30, 2022
@xsahil03x
Copy link
Contributor

Hey @geweald , I was able to reproduce this issue. Will release a fix soon 👍🏼

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

Successfully merging a pull request may close this issue.

3 participants