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

Sling model - multiple invocation

Avatar

Avatar
Shape 1
Level 1
remakj
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Shape 1
View profile

Avatar
Shape 1
Level 1
remakj
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Shape 1
View profile
remakj
Level 1

11-02-2021

Hello All, 

 

 We have an issue with 1 of our "card list" components. The card list model fires a AEM query using query builder API to get a list of pages under the current locale node with a particular template type. This result is then iterated to retrieve some properties like Title, Desc, Image, Authors, Date Published etc.. This is then rendered in HTML by HTL with expressions. We are using a max limit on the query to 100.

 

The component works as expected, however we are observing the Sling model is being instantiated twice. This is adding extra load to the server and negatively impacting the page load performance as well. Further on analysis, we observed removing the img tag in the component fixes the issue. Just adding the img tag ( even with hard coded url instead of sling model reference) causes the issue. We are using 6.4.8.

 

Any ideas what could be causing this issue would help our investigations.

 

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
Shashi_Mulugu
MVP

Likes

232 likes

Total Posts

294 posts

Correct Reply

67 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Applaud 100
Establish
View profile

Avatar
Springboard
MVP
Shashi_Mulugu
MVP

Likes

232 likes

Total Posts

294 posts

Correct Reply

67 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Applaud 100
Establish
View profile
Shashi_Mulugu
MVP

16-02-2021

@remakj can you post your HTL code maybe with dummy references also fine..

 

Without calling sling model twice in HTL or without adding more than one component of same type to page, I don't see any possibility of calling sling model twice.

Answers (2)

Answers (2)

Avatar

Avatar
Ignite 1
MVP
Ankur_Khare
MVP

Likes

159 likes

Total Posts

370 posts

Correct Reply

58 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Ignite 1
MVP
Ankur_Khare
MVP

Likes

159 likes

Total Posts

370 posts

Correct Reply

58 solutions
Top badges earned
Ignite 1
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ankur_Khare
MVP

16-02-2021

Could you please add the code so that we can check how it's getting called twice as it's not possible until its called twice.

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,048 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

484 likes

Total Posts

1,048 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

16-02-2021

To understand how you have implemented your component , your Card List component has a Sling Model, which internally query as you mentioned right ? 

 

If that is the case how the image tag is invoking the sling model ?