Excluding follow button in the header from being added to the stack (#5723)

This commit is contained in:
Anurag Shivarathri 2021-10-07 03:37:20 +05:30 committed by GitHub
parent f1c3538283
commit 1a35250811
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -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':

View file

@ -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', () => {

View file

@ -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) {