tl-its-umich-edu / canvas-course-manager-next

Canvas Course Manager Next: A redesign of the existing CCM application. It extends Canvas features, makes cumbersome features easier to use, and adds new features.
8 stars 9 forks source link

Error message flashed in confusing way before redirect for OAuth #372

Open ssciolla opened 2 years ago

ssciolla commented 2 years ago

Currently, if the user manually removes the tool's integration with Canvas from the Canvas side (in the user's Settings), then tries to reload CCM (or make an API call on a preloaded client), an error message will flash briefly before the user is redirected to the root (App.tsx) and then shown the authorize text (AuthorizePrompt.tsx). This is because an UnauthorizedError is ultimately thrown, but the redirect (window.href = '/') takes a couple moments to take effect. This can be somewhat confusing to the user, though ultimately it shouldn't hamper their use of the tool.

Unfortunately, because the redirect occurs in a plain JS/TS utility function, rather than a React component, it's not simple to change what the user sees without also modifying error handling, and making changes in many places.

One possible solution would be to delay a second or two after redirecting before resolving the function (handleErrors is async), which would likely hide the error, though the user may see loading content flicker.

https://user-images.githubusercontent.com/35741256/160708551-e8a7e636-4ed7-4885-a4dc-e6e27ed9f98f.mov