Bug #90546

Charts won't render from time to time

Added by Daniel Siepmann about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Category:
Dashboard
Target version:
Start date:
2020-02-27
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

From time to time while loading the dashboard I receive the following error in Browser Console:

Error: Module name "TYPO3/CMS/Dashboard/Contrib/chartjs" has not been loaded yet for context: _
https://requirejs.org/docs/errors.html#notloaded

Whenever this error occurs, the charts are not rendered. I guess because the chartjs module is missing ;)

I've no clue yet what's causing this issue, or how to reproduce.

Used browser: Firefox "73.0.1 (64-bit)" on ubuntu.


Related issues

Related to TYPO3 Core - Feature #90440: Dashboard widget type: Bar chartClosed2020-02-19

Actions
#1

Updated by Daniel Siepmann about 1 year ago

Accordingly to https://requirejs.org/docs/errors.html#notloaded, the current implementation should be wrong.

Not sure how to adjust https://github.com/TYPO3/TYPO3.CMS/blob/master/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts to generate the expected code, but https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js currently contains:

define(['require',
'exports',
'jquery'], (function (e, t, n) {
  'use strict';
  let r = e('TYPO3/CMS/Dashboard/Contrib/chartjs');

Which should be:

define(['require',
'exports',
'jquery', 'TYPO3/CMS/Dashboard/Contrib/chartjs'], (function (e, t, n) {
  'use strict';
  let r = e('TYPO3/CMS/Dashboard/Contrib/chartjs');

See:

In particular, the following will not work:

//THIS WILL FAIL
define(['require'], function (require) {
var namedModule = require('name');
});

This fails because requirejs needs to be sure to load and execute all dependencies before calling the factory function above. If a dependency array is given to define(), then requirejs assumes that all dependencies are listed in that array, and it will not scan the factory function for other dependencies. So, either do not pass in the dependency array, or if using the dependency array, list all the dependencies in it.

If part of a require() callback, all the dependencies need to be listed in the array:

require(['require', 'name'], function (require) {
var namedModule = require('name');
});

Be sure that require('name') only occurs inside a define() definition function or a require() callback function, never in the global space by its own.

#2

Updated by Georg Ringer about 1 year ago

  • Status changed from New to Accepted
#3

Updated by Markus Klein about 1 year ago

#4

Updated by Gerrit Code Review about 1 year ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63472

#5

Updated by Andreas Fernandez about 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#6

Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF