Closed Bug 1010236 Opened 6 years ago Closed 5 years ago

[Messages] When setting recipients.length, we should rerender only if the length decreases

Categories

(Firefox OS Graveyard :: Gaia::SMS, defect)

x86_64
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julienw, Assigned: solfen, Mentored)

Details

(Whiteboard: [sms-papercuts][lang=js][good first bug])

Attachments

(1 file)

46 bytes, text/x-github-pull-request
julienw
: review+
Details | Review
In [1], we render each time the length is set. However it seems we set "recipients.length = 0" several times during some panel transitions, and as a result we call "render" each of this times.

"render" does not look to be that expensive when length is 0, but it stills do some operations that look costly even in that case (accessing textContent, calling scrollIntoView).

Therefore it looks to be an helpful and easy change to prevent calling it too many times.

[1] https://github.com/mozilla-b2g/gaia/blob/5fd5c952cdc6f89613ccf6fa0f7f39fee9898bb9/apps/sms/js/recipients.js#L147
Whiteboard: [sms-papercuts]
Mentor: felash
Whiteboard: [sms-papercuts] → [sms-papercuts][lang=js][good first bug]
Attached file pull request github
Attachment #8515508 - Flags: review?(felash)
Assignee: nobody → maxime.lore
Comment on attachment 8515508 [details] [review]
pull request github

r=me with a nit
Attachment #8515508 - Flags: review?(felash) → review+
Fixed the nits and landed:
master: 1aec4232e08f4e123692aa8c025d57b924da138c

thanks a lot Maxime!
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.