Quando si utilizza <LightDarkImg />, ricevo un errore sconcertante che non fornisce alcuna indicazione effettiva sulla causa del problema.
Errore:
index.js:1755
Uncaught (in promise) TypeError: eC(...) is not a function
at index.js:1755:48
at index.js:64:37
at X (index.js:416:5)
at k (index.js:62:16)
at index.js:1759:46
at index.js:64:37
at X (index.js:416:5)
at k (index.js:62:16)
at m.get (index.js:84:60)
at Array Iterator.next (<anonymous>)
at A.getValue (index.js:244:86)
at index.js:222:52
at index.js:64:37
at X (index.js:416:5)
at k (index.js:62:16)
at index.js:1841:47
at index.js:64:37
at X (index.js:416:5)
at k (index.js:62:16)
at Object.evaluate (index.js:807:13)
at Object.evaluate (index.js:103:106)
at tr.evaluateSyscall (index.js:2873:20)
at tr.evaluateInner (index.js:2852:64)
at tr.evaluateOuter (index.js:2849:10)
at tH.next (index.js:4167:45)
at tH._execute (index.js:4157:21)
at tH.execute (index.js:4133:41)
at tj.handleException (index.js:3450:19)
at tR.handleException (index.js:3592:52)
at tF.throw (index.js:3414:16)
at G.evaluate (index.js:565:42)
at tF._execute (index.js:3401:34)
at tF.execute (index.js:3393:17)
at tU.rerender (index.js:3610:8)
at tq.render (index-BCp6wOJU.js:4639:55)
at index-BCp6wOJU.js:4934:16
at eX (index.js:2414:7)
at tG._renderRoots (index-BCp6wOJU.js:4914:7)
at tG._renderRootsTransaction (index-BCp6wOJU.js:4962:12)
at tG._revalidate (index.js:4995:10)
at invoke (index.js:262:14)
at m.flush (index.js:180:11)
at g.flush (index.js:334:19)
at q._end (index.js:762:32)
at q.end (index.js:565:10)
at q._run (index.js:806:14)
at q._join (index.js:783:19)
at q.join (index.js:605:17)
at Array.<anonymous> (index-BCp6wOJU.js:4728:26)
at q._trigger (index.js:860:21)
at q._end (index.js:775:16)
at _boundAutorunEnd (index.js:499:12)
get logoImg() {
if (settings.show_category_logo && this.args.category.uploaded_logo) {
console.log(this.args.category.uploaded_logo.url);
return this.args.category.uploaded_logo;
} else if (
settings.show_category_logo &&
settings.show_parent_category_logo &&
this.args.category.parentCategory &&
this.args.category.parentCategory.uploaded_logo
) {
return this.args.category.parentCategory.uploaded_logo;
} else if (settings.show_site_logo && this.siteSettings.logo_small) {
return this.siteSettings.logo_small;
} else {
return false;
}
}
get darkLogoImg() {
if (settings.show_dark_mode_category_logo && this.args.category.uploaded_logo_dark.url) {
console.log(this.args.category.uploaded_logo_dark.url);
return this.args.category.uploaded_logo_dark;
} else if (
settings.show_dark_mode_category_logo &&
settings.show_parent_category_dark_mode_logo &&
this.args.category.parentCategory &&
this.args.category.parentCategory.uploaded_logo_dark
) {
return this.args.category.parentCategory.uploaded_logo_dark;
} else if (settings.show_site_logo && this.siteSettings.logo_small) {
return this.siteSettings.logo_small;
} else {
return this.args.category.uploaded_logo; // Se non viene caricato alcun logo per la modalitĂ scura, utilizza il logo normale
}
}
Sto registrando tutto nel suddetto componente LightDarkImg (duplicato nel mio filesystem) e gli URL delle immagini vengono stampati correttamente. Vengono visualizzati correttamente anche quando sono all’interno di tag <img>.
Questo pezzo sembra sospetto. Racchiudere qualcosa tra parentesi in un template Ember lo fa trattare come un helper (cioè una funzione). Quindi penso che tu voglia rimuovere un livello di parentesi lì:
A proposito, stai sviluppando contro un’istanza di produzione qui? Se invece usi un’istanza di sviluppo, dovresti ottenere un messaggio di errore molto migliore.
Grazie per il suggerimento. Funziona normalmente, su un altro branch :occhi:, ma lo farò comunque. Usando la produzione, passerò allo sviluppo e vedrò se aiuta.