instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.41k stars 2.42k forks source link

When using the rich text editor to search for and display some embedded media TypeError occurs #2285

Closed jonespm closed 2 months ago

jonespm commented 7 months ago

We've noticed in the last few weeks that when using the Rich Text Editor button to browse for and search for some external tool media this javascript error occurs in the console. It also occurs when trying to display and play some content in an iframe that's linked using this method. I don't know what specifics but it seems to be more with video content like Kaltura.

VM4169 main-e-38975df019.js:30685 Uncaught TypeError: Cannot read properties of undefined (reading 'instui_nav')
    at VM4169 main-e-38975df019.js:30685:366
    at VM4169 main-e-38975df019.js:31225:30
    at VM4169 main-e-38975df019.js:31225:34

This seems like it might be causing some issues for some users. It looks like in the iframe the window.ENV isn't always available. This should probably be handled in an exception or else the ENV should be available.

I believe this recent change is where this error is coming from.

Thanks!

https://github.com/instructure/canvas-lms/blame/634fb0023076467fcab6482036b54b6f8c2a18f7/ui/boot/initializers/router.tsx#L34

aaronshaf commented 7 months ago

I wonder here if lack of access to localStorage (in localStorage.instui_nav_dev, due to iframe policy) is the issue.

aaronshaf commented 7 months ago

Looking at this again on Monday. Ultimately I think we need to reduce our use of the "bare" layout, which loads too much JS (including in iframe contexts?).

jonespm commented 2 months ago

I'm not longer seeing this issue so must have been incorporated, going to close.