VM110:726 Uncaught TypeError: Cannot read property 'data' of undefined
at HTMLSpanElement.eval (eval at _compileFunction (require-kernel.js?v=c6e36b0f:226), <anonymous>:726:15)
at Function.each (ace2_common.js?callback=require.define&v=c6e36b0f:750)
at jQuery.fn.init.each (ace2_common.js?callback=require.define&v=c6e36b0f:543)
at EpComments.localizeExistingComments (eval at _compileFunction (require-kernel.js?v=c6e36b0f:226), <anonymous>:713:15)
at Object.eval (eval at _compileFunction (require-kernel.js?v=c6e36b0f:226), <anonymous>:111:10)
at Object.trigger (html10n.js?v=c6e36b0f:106)
at html10n.js?v=c6e36b0f:716
at html10n.js?v=c6e36b0f:955
at each (html10n.js?v=c6e36b0f:745)
at Loader.window.html10n.Loader.load (html10n.js?v=c6e36b0f:1
Observations
Happens sometimes, ONLY when cache is ENABLED
It seems at when localizeExistingComments runs, the commentId is set, BUT this.comments is empty.
Causes?
Probably race condition as the localization and getComments race each other. If getComments wins, the error occurs.
Possible fixes?
Check that this.comments array has the comment like collectComments does. Do nothing if it does not exist. It adds no extra problems as there is an interval to check and localize comments.
Call this.collectComments(); in localizeExistingComments.
Reproduce
Result
SOMETIMES I get an error:
Observations
localizeExistingComments
runs, thecommentId
is set, BUTthis.comments
is empty.Causes?
getComments
race each other. IfgetComments
wins, the error occurs.Possible fixes?
this.comments
array has the comment likecollectComments
does. Do nothing if it does not exist. It adds no extra problems as there is an interval to check and localize comments.this.collectComments();
in localizeExistingComments.