OpenWaterFoundation / owf-app-infomapper-builder-ng

Open Water Foundation web application to build an InfoMapper configuration
GNU General Public License v3.0
0 stars 0 forks source link

Inconsistent bizarre nav bar creation #5

Closed Nightsphere closed 1 year ago

Nightsphere commented 1 year ago

Sometimes the builder behaves oddly in that it successfully compiles with no errors or warnings, and yet the main navigation bar does not correctly render the Angular Material button or icon button (the icon button is the tiny rectangle above the "InfoMapper Builder" menu button in the image below).

image

I originally thought it was a clash between Angular Material and bootstrap. After removing bootstrap (as it wasn't being used anywhere) the nav bar successfully showed the buttons, so I thought the issue was resolved. It's doing it again however, and I'm still not sure what the issue stems from and how to fix it. It also seems to happen randomly.

The code in the nav bar has not been changed, so it doesn't make sense that it wouldn't work without any errors when other components in the project work fine. All components are inside the same NgModule, which means all components can use imported modules (like mat-button and mat-icon-button).

As I was typing the previous paragraph I realized the nav bar code hadn't been changed, so I made a trivial change somewhere in the component, and recompiled. It ended up working, and the buttons were back to normal.

image

I believe this occurred again when components were moved around. I changed the location of some and moved them around for better organization. Even killing the local server and rerunning did not fix the issue until I made the change in the component. This might be a bug with ng-packagr, but this is also just an educated guess at this point. I'll keep this issue open until I'm convinced what is the cause and solution to this odd behavior.

Nightsphere commented 1 year ago

It happened again today when I changed the name of a folder that a component was in, along with the component's .ts, .html, .scss, and NgModule declaration name. Making a trivial update to both the nav bar and side nav (which I noticed was also exhibiting the same behavior), fixed the issue. I did each one in sequence, not parallel, i.e. I made a change in nav bar, refreshed and saw the issue resovled, then made a chang in side nav, refreshed and saw its issue resolved as well.

This seems like it's a bug or some regression of some kind. I might try to open an issue or see if one exists already on the Angular GitHub account. I have ruled out the common package being the culprit, so I don't think I'll need to bring this up to ng-packgr. Maybe I'll keep this open as a reminder until I open an issue and hear back from Angular.

Nightsphere commented 1 year ago

Try deleting the .angular file?

https://stackoverflow.com/questions/71896562/angular-error-typeerror-cannot-read-properties-of-undefined-reading-ondestroy

Nightsphere commented 1 year ago

Deleting the .angular folder (not a file) and its contents, then rerunning ng serve worked. It's a little faster than going through and making menial changes to a dozen components in the app, and much less of a headache. I will do this in the future, and add to the troubleshooting section about resolving this issue.