diff --git a/app/mattermost.js b/app/mattermost.js index 84bcc05de..54e0b99e9 100644 --- a/app/mattermost.js +++ b/app/mattermost.js @@ -105,7 +105,9 @@ Navigation.events().registerAppLaunchedListener(() => { }); export function componentDidAppearListener({componentId}) { - EphemeralStore.addNavigationComponentId(componentId); + if (componentId.indexOf('!screen') !== 0) { + EphemeralStore.addNavigationComponentId(componentId); + } switch (componentId) { case 'MainSidebar': diff --git a/app/mattermost.test.js b/app/mattermost.test.js index f03fa2344..abd366737 100644 --- a/app/mattermost.test.js +++ b/app/mattermost.test.js @@ -52,6 +52,12 @@ describe('componentDidAppearListener', () => { expect(EventEmitter.emit).toHaveBeenCalledTimes(1); expect(EventEmitter.emit).toHaveBeenCalledWith(NavigationTypes.BLUR_POST_DRAFT); }); + + it('should not add componentIds starting with "!screen" to the store as they are not screens', () => { + const componentId = '!screen'; + componentDidAppearListener({componentId}); + expect(EphemeralStore.addNavigationComponentId).not.toHaveBeenCalledWith(componentId); + }); }); describe('componentDidDisappearListener', () => { diff --git a/app/screens/thread/thread_base.js b/app/screens/thread/thread_base.js index b683e6bb2..7f63d5bba 100644 --- a/app/screens/thread/thread_base.js +++ b/app/screens/thread/thread_base.js @@ -57,7 +57,8 @@ export default class ThreadBase extends PureComponent { if (props.collapsedThreadsEnabled) { // Without unique id, it breaks navigation from permalink view. - this.threadFollowId = Math.floor(Math.random() * 0x10000000000).toString(16); + // Adding prefix "!screen" to exclude it from being added to stack + this.threadFollowId = '!screen-' + Math.floor(Math.random() * 0x10000000000).toString(16); let titleText; if (channelType === General.DM_CHANNEL) {