@@ -19,7 +19,6 @@ const useOrangeLine = () => {
1919 identifyBehavior : T . RPCGen . TLFIdentifyBehavior . chatGui ,
2020 readMsgID : readMsgID < 0 ? 0 : readMsgID ,
2121 } )
22-
2322 setOrangeLine ( T . Chat . numberToOrdinal ( unreadlineRes . unreadlineID ? unreadlineRes . unreadlineID : 0 ) )
2423 }
2524 C . ignorePromise ( f ( ) )
@@ -30,11 +29,11 @@ const useOrangeLine = () => {
3029 loadOrangeLine ( )
3130 } , [ loadOrangeLine ] )
3231
33- const { markedAsUnread, maxMsgID , readMsgID } = C . useChatContext (
32+ const { markedAsUnread, maxVisibleMsgID } = C . useChatContext (
3433 C . useShallow ( s => {
35- const { maxMsgID , readMsgID } = s . meta
34+ const { maxVisibleMsgID } = s . meta
3635 const { markedAsUnread} = s
37- return { markedAsUnread, maxMsgID , readMsgID }
36+ return { markedAsUnread, maxVisibleMsgID }
3837 } )
3938 )
4039
@@ -47,13 +46,14 @@ const useOrangeLine = () => {
4746 }
4847 } , [ loadOrangeLine , markedAsUnread ] )
4948
50- // we're not looking add a line
49+ // just use the rpc for orange line if we're not active
50+ // if we are active we want to keep whatever state we had so it is maintained
5151 const active = C . useActiveState ( s => s . active )
5252 React . useEffect ( ( ) => {
53- if ( ! active && readMsgID < maxMsgID ) {
54- setOrangeLine ( T . Chat . numberToOrdinal ( readMsgID + 0.0001 ) )
53+ if ( ! active ) {
54+ loadOrangeLine ( )
5555 }
56- } , [ active , maxMsgID , readMsgID ] )
56+ } , [ maxVisibleMsgID , loadOrangeLine , active ] )
5757
5858 // mobile backgrounded us
5959 const mobileAppState = C . useConfigState ( s => s . mobileAppState )
0 commit comments