Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM SPA Routing Issues with hash and query parameter

Avatar

Avatar
Validate 1
Level 5
viveksachdeva
Level 5

Likes

52 likes

Total Posts

225 posts

Correct Reply

35 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 5
viveksachdeva
Level 5

Likes

52 likes

Total Posts

225 posts

Correct Reply

35 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
viveksachdeva
Level 5

04-06-2020

Hey guys,

 

We are using AEM with React and having trouble with SPA Routing. We are facing an intermittent issue when the Link contains # or ?

Page data is available using .model.json on the page URI but sometimes when we have # and ?, model.json is added after full URL rather than just path and hence it fails.

And it happens when on dispatcher only when we dont have .html in the URL.

E.g:

Lets say a React Link points to /en/mypage?cid=campaign

I expect data call for this to be  /en/mypage.model.json but sometimes it is sent as /en/mypage?cid=campaign.model.json

 

This logic is abstracted in the node module and hence difficult to check. Anyone else faced similar issue?

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 2
dzmitryk7401781
Level 2

Likes

4 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
dzmitryk7401781
Level 2

Likes

4 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
dzmitryk7401781
Level 2

22-03-2021

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
MVP
Nikhil-Kumar
MVP

Likes

240 likes

Total Posts

253 posts

Correct Reply

38 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile

Avatar
Validate 1
MVP
Nikhil-Kumar
MVP

Likes

240 likes

Total Posts

253 posts

Correct Reply

38 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 5
Give Back 3
View profile
Nikhil-Kumar
MVP

24-08-2020

@viveksachdeva 

Try playing around with the dipatcher re-write rules if it helps.

We guys also implemented similar thing but didn't faced such issue.

Avatar

Avatar
Validate 1
Level 2
dzmitryk7401781
Level 2

Likes

4 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
dzmitryk7401781
Level 2

Likes

4 likes

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
dzmitryk7401781
Level 2

05-03-2021

We also have the same issue appearing, right after we started to rewrite URLs removing `.html` bit in a page path.

 

Looks to me that URL parsing code in the routing library contains a bug for the case of absent page extension and should be fixed.