@@ -333,11 +333,19 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
333333 connection ?? = globalStore.apiConnectionFromAccount (account);
334334 assert (connection.zulipFeatureLevel == account.zulipFeatureLevel);
335335
336+ final queueId = initialSnapshot.queueId;
337+ if (queueId == null ) {
338+ // The queueId is optional in the type, but should only be missing in the
339+ // case of unauthenticated access to a web-public realm. We authenticated.
340+ throw Exception ("bad initial snapshot: missing queueId" );
341+ }
342+
336343 final realmUrl = account.realmUrl;
337344 final channels = ChannelStoreImpl (initialSnapshot: initialSnapshot);
338345 return PerAccountStore ._(
339346 globalStore: globalStore,
340347 connection: connection,
348+ queueId: queueId,
341349 realmUrl: realmUrl,
342350 realmWildcardMentionPolicy: initialSnapshot.realmWildcardMentionPolicy,
343351 realmMandatoryTopics: initialSnapshot.realmMandatoryTopics,
@@ -381,6 +389,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
381389 PerAccountStore ._({
382390 required GlobalStore globalStore,
383391 required this .connection,
392+ required this .queueId,
384393 required this .realmUrl,
385394 required this .realmWildcardMentionPolicy,
386395 required this .realmMandatoryTopics,
@@ -420,6 +429,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
420429 final GlobalStore _globalStore;
421430 final ApiConnection connection; // TODO(#135): update zulipFeatureLevel with events
422431
432+ final String queueId;
423433 UpdateMachine ? get updateMachine => _updateMachine;
424434 UpdateMachine ? _updateMachine;
425435 set updateMachine (UpdateMachine ? value) {
@@ -997,12 +1007,7 @@ class UpdateMachine {
9971007 UpdateMachine .fromInitialSnapshot ({
9981008 required this .store,
9991009 required InitialSnapshot initialSnapshot,
1000- }) : queueId = initialSnapshot.queueId ?? (() {
1001- // The queueId is optional in the type, but should only be missing in the
1002- // case of unauthenticated access to a web-public realm. We authenticated.
1003- throw Exception ("bad initial snapshot: missing queueId" );
1004- })(),
1005- lastEventId = initialSnapshot.lastEventId {
1010+ }) : lastEventId = initialSnapshot.lastEventId {
10061011 store.updateMachine = this ;
10071012 }
10081013
@@ -1068,7 +1073,6 @@ class UpdateMachine {
10681073 }
10691074
10701075 final PerAccountStore store;
1071- final String queueId;
10721076 int lastEventId;
10731077
10741078 bool _disposed = false ;
@@ -1209,7 +1213,7 @@ class UpdateMachine {
12091213 final GetEventsResult result;
12101214 try {
12111215 result = await getEvents (store.connection,
1212- queueId: queueId, lastEventId: lastEventId);
1216+ queueId: store. queueId, lastEventId: lastEventId);
12131217 if (_disposed) return ;
12141218 } catch (e, stackTrace) {
12151219 if (_disposed) return ;
0 commit comments