stats4sd / Stats4SD-Resources-Site

Reposistory for the Stats4SD Resources Repository
https://resources.stats4sd.org
GNU General Public License v3.0
0 stars 0 forks source link

app/duplicate app on About Page #154

Closed dave-mills closed 6 years ago

dave-mills commented 6 years ago

When visiting the about page, I get the error:

uncaught exception: SSD-Resources: Firebase: Firebase App named 'SSD-Resources' already exists (app/duplicate-app).

After this, any list or search pages I have not already visited won't load.

chrismclarke commented 6 years ago

@dave-mills tl;dr - all pages need to be listed in the polymer.json fragments array

It's a weird bug and technically not actually due to firebase. From what I can gather, if your imports are messed up (e.g. pages trying to import files which don't exist/haven't been installed with bower) then the browser reruns some of its original initialisation to try and find it. This process finds a way to trigger the re-registering of the firebase app which will always throw an error.

The reason the about page causes these problems but none others is because it wasn't defined in the polymer.json fragments array. The builder can identify most of the files that are required by looking through the import statements, following paths and looking at the new imports, however this fails to pick up on any of the page files. This is because the page files are not imported via href urls at the top of the .html files but instead dynamically imported using a Polymer.importHref() function in the app-html file (to allow for lazy loading).