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

Intermittent TypeError in Music App: Cannot Read "getIconUrl" Property #1137

Closed
andrewfromtver opened this issue Mar 18, 2024 · 3 comments
Closed
Labels
6 - Ready for release Fix or feature is ready and will be included in the next release Bug

Comments

@andrewfromtver
Copy link

Steps to reproduce

  • Install Music app
  • Go to Music tab

Versions:

  • Nextcloud version: 28.0.3
  • Music app version: 1.10.0

Description:

The issue occurs intermittently in the Music application where it fails to load properly, resulting in a TypeError. The error message indicates that the application is attempting to read properties of an undefined object, specifically 'getIconUrl'. This issue disrupts the normal functioning of the application.

Error Log:

webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2 TypeError: Cannot read properties of undefined (reading 'getIconUrl')
    at Object.<anonymous> (webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:303745)
    at Object.invoke (webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:60133)
    at webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:94084
    at se (webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:85003)
    at webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:78457
    at se (webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:85649)
    at webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:78457
    at webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:77772
    at webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:44174
    at c.$eval (webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2:136349)
(anonymous) @ webpack.app.ed7a3d4fa79d10ae7b4c.js?v=acdb7557-14:2

Screenshot:

image

@paulijar paulijar added the Bug label Mar 18, 2024
@paulijar
Copy link
Collaborator

Thanks for the report. I haven't seen this happen, but the only line of code calling getIconUrl is this one here:

folderStyle.innerHTML = `#app-view .icon-folder { background-image: url(${OC.MimeType.getIconUrl('dir')}) }`;

I presume that, on your system, the global object OC.MimeType is not always initialized by the time we execute that line. This may depend on many factors, including at least the exact version of Nextcloud, the used browser, and random factors. I guess we need to add some logic there, checking the existence of OC.MimeType and scheduling a new check to happen later if the reference is not present yet.

paulijar added a commit that referenced this issue Apr 18, 2024
It happens sometimes (but quite rarely at least on my tests) that all
the needed parts of the Nextcloud server core are not yet loaded at the
time when our controllers are being initialized. Previously such cases
caused the page loading to fail but now we are prepared: If the needed
parts of the core are not available immediately, then we postpone the
related initialization steps and retry after 500 ms. Attempts are
continued until when they succeed.

In the GitHub issue, the problem was reported to happen with the
reference OC.MimeType, but fixing this case reveled that there was a
similar case related to the HTML element #app-navigation-toggle.

refs #1137
@paulijar paulijar added the 6 - Ready for release Fix or feature is ready and will be included in the next release label Apr 18, 2024
@paulijar
Copy link
Collaborator

This is now fixed in Music v1.11.0.

@andrewfromtver
Copy link
Author

Great news, thanks! Updated music app right now and confirm that everything works perfect now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6 - Ready for release Fix or feature is ready and will be included in the next release Bug
Projects
None yet
Development

No branches or pull requests

2 participants