@@ -360,11 +360,19 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
360360 connection ?? = globalStore.apiConnectionFromAccount (account);
361361 assert (connection.zulipFeatureLevel == account.zulipFeatureLevel);
362362
363+ final queueId = initialSnapshot.queueId;
364+ if (queueId == null ) {
365+ // The queueId is optional in the type, but should only be missing in the
366+ // case of unauthenticated access to a web-public realm. We authenticated.
367+ throw Exception ("bad initial snapshot: missing queueId" );
368+ }
369+
363370 final realmUrl = account.realmUrl;
364371 final channels = ChannelStoreImpl (initialSnapshot: initialSnapshot);
365372 return PerAccountStore ._(
366373 globalStore: globalStore,
367374 connection: connection,
375+ queueId: queueId,
368376 realmUrl: realmUrl,
369377 realmWildcardMentionPolicy: initialSnapshot.realmWildcardMentionPolicy,
370378 realmMandatoryTopics: initialSnapshot.realmMandatoryTopics,
@@ -408,6 +416,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
408416 PerAccountStore ._({
409417 required GlobalStore globalStore,
410418 required this .connection,
419+ required this .queueId,
411420 required this .realmUrl,
412421 required this .realmWildcardMentionPolicy,
413422 required this .realmMandatoryTopics,
@@ -447,6 +456,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, UserStore, Channel
447456 final GlobalStore _globalStore;
448457 final ApiConnection connection; // TODO(#135): update zulipFeatureLevel with events
449458
459+ final String queueId;
450460 UpdateMachine ? get updateMachine => _updateMachine;
451461 UpdateMachine ? _updateMachine;
452462 set updateMachine (UpdateMachine ? value) {
@@ -1024,12 +1034,7 @@ class UpdateMachine {
10241034 UpdateMachine .fromInitialSnapshot ({
10251035 required this .store,
10261036 required InitialSnapshot initialSnapshot,
1027- }) : queueId = initialSnapshot.queueId ?? (() {
1028- // The queueId is optional in the type, but should only be missing in the
1029- // case of unauthenticated access to a web-public realm. We authenticated.
1030- throw Exception ("bad initial snapshot: missing queueId" );
1031- })(),
1032- lastEventId = initialSnapshot.lastEventId {
1037+ }) : lastEventId = initialSnapshot.lastEventId {
10331038 store.updateMachine = this ;
10341039 }
10351040
@@ -1103,7 +1108,6 @@ class UpdateMachine {
11031108 }
11041109
11051110 final PerAccountStore store;
1106- final String queueId;
11071111 int lastEventId;
11081112
11091113 bool _disposed = false ;
@@ -1253,7 +1257,7 @@ class UpdateMachine {
12531257 final GetEventsResult result;
12541258 try {
12551259 result = await getEvents (store.connection,
1256- queueId: queueId, lastEventId: lastEventId);
1260+ queueId: store. queueId, lastEventId: lastEventId);
12571261 if (_disposed) return ;
12581262 } catch (e, stackTrace) {
12591263 if (_disposed) return ;
0 commit comments