Skip to main content
deleted 4 characters in body
Source Link
sfdcfox
  • 501.7k
  • 21
  • 473
  • 828

afterAfter 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

noNo 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, the event is fired, which should not happen (if I understand the component 'scomponent's documentation correctly).

It is, and should, be fired if I had some other kind of navigation dependantdependent 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

(thisThis 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?

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 dependant on a hash, for example, https://poc--sitepreview.cs9999.force.com/myCommunity/s/global-search/TEST

-->

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?

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?

Tweeted twitter.com/StackSalesforce/status/1012000023264026630
edited tags
Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431
Source Link
glls
  • 20.3k
  • 19
  • 49
  • 83

Using aura locationChange in lightning communities

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 dependant on a hash, for example, https://poc--sitepreview.cs9999.force.com/myCommunity/s/global-search/TEST

-->

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?