After further testing and reading on aura:locationChange component:
This event is automatically fired when the hash part of the URL has changed.
I understand that, in my community URL, If i navigate from my home page:
https://poc--sitepreview.cs9999.force.com/myCommunity/s/
To my search page:
https://poc--sitepreview.cs9999.force.com/myCommunity/s/global-search/TEST
No event should be triggered, since there is no hash part in the url, same should I navigate to a record page, since no hash is appended to the url.
However, when I click back from a record page to my search page (all default standard pages in my lightning community using the Napili template), the event is fired, which should not happen (if I understand the component's documentation correctly).
It is, and should, be fired if I had some other kind of navigation dependent on a hash, for example:
https://poc--sitepreview.cs9999.force.com/myCommunity/s/global-search/TEST to https://poc--sitepreview.cs9999.force.com/myCommunity/s/global-search/TEST#someCustomhash
(This does fire the event)
The only 3 scenarios where I see the event firing so far is when I do history back or forward in my browser (not sure if this is normal), or there is actually a hash change on my page.
Is this accurate? and should history back/forward be triggering the event?