Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ILAG: browser's back button doesn't work when navigating from /login (or /register) to /home #4061

Closed
ara4n opened this issue May 28, 2017 · 5 comments
Assignees
Labels
P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@ara4n
Copy link
Member

ara4n commented May 28, 2017

No description provided.

@ara4n ara4n mentioned this issue May 30, 2017
14 tasks
@lukebarnard1
Copy link
Contributor

lukebarnard1 commented May 30, 2017

This is actually because going to /login causes the client to update its state to reflect being logged out. So the browser history is there but state.loggedIn on <MatrixChat> has become false.

I find it odd that by default, changing screen will log the user out:

    setStateForNewScreen: function(state) {
        const newState = {
            screen: undefined,
            viewUserId: null,
            loggedIn: false,
            ready: false,
            upgradeUsername: null,
            guestAccessToken: null,
       };
       Object.assign(newState, state);
       this.setState(newState);
    },

@lampholder lampholder added T-Defect P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround labels May 30, 2017
@lukebarnard1 lukebarnard1 self-assigned this Jun 1, 2017
@lukebarnard1
Copy link
Contributor

OK, so I've realised why it's actually not odd - setStateForNewScreen only happens for lifecycle operations like registering, logging in, resetting a password. Setting loggedIn takes the user out of the LoggedInView which makes sense.

So we could set the default loggedIn to true and have separate state for indicating the intention to be "outside" of the app (not being in LoggedInView).

@ara4n
Copy link
Member Author

ara4n commented Jun 13, 2017

this is nasty, but probably not a release blocker

@lampholder lampholder changed the title ILAG: browser's back button doesn't work when navigating from /login to /home ILAG: browser's back button doesn't work when navigating from /login (or /register) to /home Aug 16, 2017
@lukebarnard1 lukebarnard1 removed their assignment Nov 6, 2017
@ara4n
Copy link
Member Author

ara4n commented Dec 20, 2018

this drives me nuts :(

@turt2live turt2live self-assigned this Dec 20, 2018
turt2live added a commit to matrix-org/matrix-react-sdk that referenced this issue Dec 21, 2018
All of the anchors were pointed at `#` which, when clicked, would trigger a hash change in the browser. This change races the change made by the screen handling where the screen handling ends up losing. Because the hash is then tracked as empty rather than `#/login` (for example), the state machine considers future changes as no-ops and doesn't do anything with them.

By using `preventDefault` and `stopPropagation` on the anchor click events, we prevent the browser from automatically going to an empty hash, which then means the screen handling isn't racing the browser, and the hash change state machine doesn't no-op.

After applying that fix, going between pages worked great unless you were going from /login to /home. This is because the MatrixChat state machine was now out of sync (a `view` of `LOGIN` but a `page` of `HomePage` - an invalid state). All we have to do here is ensure the right view is used when navigating to the homepage. 

Fixes element-hq/element-web#4061

Note: the concerns in 4061 about logging out upon entering the view appear to have been solved. Navigating to the login page doesn't obliterate your session, at least in my testing.
turt2live added a commit to matrix-org/matrix-react-sdk that referenced this issue Jan 2, 2019
All of the anchors were pointed at `#` which, when clicked, would trigger a hash change in the browser. This change races the change made by the screen handling where the screen handling ends up losing. Because the hash is then tracked as empty rather than `#/login` (for example), the state machine considers future changes as no-ops and doesn't do anything with them.

By using `preventDefault` and `stopPropagation` on the anchor click events, we prevent the browser from automatically going to an empty hash, which then means the screen handling isn't racing the browser, and the hash change state machine doesn't no-op.

After applying that fix, going between pages worked great unless you were going from /login to /home. This is because the MatrixChat state machine was now out of sync (a `view` of `LOGIN` but a `page` of `HomePage` - an invalid state). All we have to do here is ensure the right view is used when navigating to the homepage. 

Fixes element-hq/element-web#4061

Note: the concerns in 4061 about logging out upon entering the view appear to have been solved. Navigating to the login page doesn't obliterate your session, at least in my testing.
turt2live added a commit to matrix-org/matrix-react-sdk that referenced this issue Jan 2, 2019
All of the anchors were pointed at `#` which, when clicked, would trigger a hash change in the browser. This change races the change made by the screen handling where the screen handling ends up losing. Because the hash is then tracked as empty rather than `#/login` (for example), the state machine considers future changes as no-ops and doesn't do anything with them.

By using `preventDefault` and `stopPropagation` on the anchor click events, we prevent the browser from automatically going to an empty hash, which then means the screen handling isn't racing the browser, and the hash change state machine doesn't no-op.

After applying that fix, going between pages worked great unless you were going from /login to /home. This is because the MatrixChat state machine was now out of sync (a `view` of `LOGIN` but a `page` of `HomePage` - an invalid state). All we have to do here is ensure the right view is used when navigating to the homepage.

Fixes element-hq/element-web#4061

Note: the concerns in 4061 about logging out upon entering the view appear to have been solved. Navigating to the login page doesn't obliterate your session, at least in my testing.

Take out unnecessary setState when logging in

All branches of this code eventually lead to somewhere where the view state is set, making this redundant.

Add missing stopPropagation
turt2live added a commit to matrix-org/matrix-react-sdk that referenced this issue Jan 3, 2019
All of the anchors were pointed at `#` which, when clicked, would trigger a hash change in the browser. This change races the change made by the screen handling where the screen handling ends up losing. Because the hash is then tracked as empty rather than `#/login` (for example), the state machine considers future changes as no-ops and doesn't do anything with them.

By using `preventDefault` and `stopPropagation` on the anchor click events, we prevent the browser from automatically going to an empty hash, which then means the screen handling isn't racing the browser, and the hash change state machine doesn't no-op.

After applying that fix, going between pages worked great unless you were going from /login to /home. This is because the MatrixChat state machine was now out of sync (a `view` of `LOGIN` but a `page` of `HomePage` - an invalid state). All we have to do here is ensure the right view is used when navigating to the homepage. 

Fixes element-hq/element-web#4061

Note: the concerns in 4061 about logging out upon entering the view appear to have been solved. Navigating to the login page doesn't obliterate your session, at least in my testing.
turt2live added a commit to matrix-org/matrix-react-sdk that referenced this issue Jan 3, 2019
All of the anchors were pointed at `#` which, when clicked, would trigger a hash change in the browser. This change races the change made by the screen handling where the screen handling ends up losing. Because the hash is then tracked as empty rather than `#/login` (for example), the state machine considers future changes as no-ops and doesn't do anything with them.

By using `preventDefault` and `stopPropagation` on the anchor click events, we prevent the browser from automatically going to an empty hash, which then means the screen handling isn't racing the browser, and the hash change state machine doesn't no-op.

After applying that fix, going between pages worked great unless you were going from /login to /home. This is because the MatrixChat state machine was now out of sync (a `view` of `LOGIN` but a `page` of `HomePage` - an invalid state). All we have to do here is ensure the right view is used when navigating to the homepage. 

Fixes element-hq/element-web#4061

Note: the concerns in 4061 about logging out upon entering the view appear to have been solved. Navigating to the login page doesn't obliterate your session, at least in my testing.
turt2live added a commit to matrix-org/matrix-react-sdk that referenced this issue Jan 3, 2019
All of the anchors were pointed at `#` which, when clicked, would trigger a hash change in the browser. This change races the change made by the screen handling where the screen handling ends up losing. Because the hash is then tracked as empty rather than `#/login` (for example), the state machine considers future changes as no-ops and doesn't do anything with them.

By using `preventDefault` and `stopPropagation` on the anchor click events, we prevent the browser from automatically going to an empty hash, which then means the screen handling isn't racing the browser, and the hash change state machine doesn't no-op.

After applying that fix, going between pages worked great unless you were going from /login to /home. This is because the MatrixChat state machine was now out of sync (a `view` of `LOGIN` but a `page` of `HomePage` - an invalid state). All we have to do here is ensure the right view is used when navigating to the homepage. 

Fixes element-hq/element-web#4061

Note: the concerns in 4061 about logging out upon entering the view appear to have been solved. Navigating to the login page doesn't obliterate your session, at least in my testing.
@turt2live
Copy link
Member

Fixed by matrix-org/matrix-react-sdk#2383 (for experimental)

turt2live added a commit to matrix-org/matrix-react-sdk that referenced this issue Jan 3, 2019
All of the anchors were pointed at `#` which, when clicked, would trigger a hash change in the browser. This change races the change made by the screen handling where the screen handling ends up losing. Because the hash is then tracked as empty rather than `#/login` (for example), the state machine considers future changes as no-ops and doesn't do anything with them.

By using `preventDefault` and `stopPropagation` on the anchor click events, we prevent the browser from automatically going to an empty hash, which then means the screen handling isn't racing the browser, and the hash change state machine doesn't no-op.

After applying that fix, going between pages worked great unless you were going from /login to /home. This is because the MatrixChat state machine was now out of sync (a `view` of `LOGIN` but a `page` of `HomePage` - an invalid state). All we have to do here is ensure the right view is used when navigating to the homepage. 

Fixes element-hq/element-web#4061

Note: the concerns in 4061 about logging out upon entering the view appear to have been solved. Navigating to the login page doesn't obliterate your session, at least in my testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

No branches or pull requests

4 participants