Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-27497 Patch localForage to fix logging out on old Edge #6308

Merged
merged 7 commits into from
Sep 10, 2020
Merged

Conversation

hmhealey
Copy link
Member

When logging out, we call a method of localForage that in turn attempts to call a browser method that's not supported on pre-Chromium versions of Edge. There's a PR submitted to fix that (localForage/localForage#971), but it's waiting to be merged and released, so I'm taking a page from the mobile app's handbook and using patch-package to temporarily apply the patch at install time since it's easier than maintaining a fork until the next version of localForage is released.

Ticket Link

https://mattermost.atlassian.net/browse/MM-27497

@hmhealey hmhealey added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Aug 28, 2020
@hmhealey hmhealey added this to the v5.28 milestone Aug 28, 2020
@hmhealey
Copy link
Member Author

Lines 5373 to 5394 of the patch are the actual changes to fix the issue. The rest of the changes are because the library checks in their compiled files as well.

This link works, but you have to click to load the patch for it to scroll you to the right place.
https://github.com/mattermost/mattermost-webapp/pull/6308/files#diff-4499b04d71f37353f7e77b7b0cef7e29R5373-R5394

Copy link
Contributor

@enahum enahum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just as a mention the patch is creating a new file. not a blocker but strange

@hmhealey
Copy link
Member Author

The new file was actually a problem. I copied files into node_modules wrong when preparing the patch. That should be fixed now, and the patch is much easier to read now.

@hmhealey hmhealey added the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Aug 28, 2020
@calebroseland
Copy link
Member

Locally, I'm getting:

HTTP401: DENIED - The requested resource requires user authentication.
(Fetch)POST - http://mattermost.localdev:8065/api/v4/channels/members/me/view
Unhandled promise rejection TypeError: Invalid calling object  main.b3747573886923126066.js (239,43173)

[object Error]: {description: "Invalid calling object", message: "Invalid calling object", number: -2147418113, stack: "TypeError: Invalid calling object at Anonymous function (http://mattermost.localdev:8065/static/main.b3747573886923126066.js:199:48914) at T (http://mattermost.localdev:8065/static/main.b3747573886923126066.js:199:44009) at Anonymous function (http://mattermost.localdev:8065/static/main.b3747573886923126066.js:199:48814) at Anonymous function (http://mattermost.localdev:8065/static/main.b3747573886923126066.js:187:387048) at n (http://mattermost.localdev:8065/static/main.b3747573886923126066.js:239:42727)"}

@hmhealey hmhealey added the Work in Progress Not yet ready for review label Aug 31, 2020
@hmhealey
Copy link
Member Author

Yeah, I'm seeing that as well. I'll take a look since clearly this fix isn't working as well as I'd hoped

@hmhealey hmhealey removed the Work in Progress Not yet ready for review label Sep 1, 2020
@hmhealey
Copy link
Member Author

hmhealey commented Sep 1, 2020

I did some more testing locally, and for some reason the fix was still causing Edge to throw errors. I've instead gone with just downgrading localforage for the time being. Hopefully they'll have addressed the issue (or we'll have dropped old Edge :p) by the time we have to upgrade again.

Copy link
Member

@calebroseland calebroseland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, working now ✓, LGTM

@calebroseland calebroseland removed the 2: Dev Review Requires review by a core commiter label Sep 1, 2020
Copy link
Contributor

@jgilliam17 jgilliam17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @hmhealey
Tested, looks good to merge.

  • Verified user can logout successfully on the Microsoft Edge, returns to login screen. No console errors.

@jgilliam17 jgilliam17 added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester Setup Cloud Test Server Setup a test server using Mattermost Cloud labels Sep 9, 2020
@mm-cloud-bot
Copy link

Test server destroyed

@hmhealey hmhealey merged commit 23cf6ae into master Sep 10, 2020
@hmhealey hmhealey deleted the MM-27497 branch September 10, 2020 14:31
@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation labels Sep 15, 2020
@ogi-m ogi-m added the Tests/Not Needed Does not require new release tests label Oct 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation Tests/Not Needed Does not require new release tests
Projects
None yet
7 participants