Opened 10 years ago
Closed 10 years ago
#28581 closed defect (bug) (fixed)
Theme browser sidebar expand/collapse only works on every other theme
Reported by: | helen | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | has-patch commit |
Focuses: | javascript | Cc: |
Description
Steps:
- Go to add themes.
- Open up the details view.
- Expand/collapse the sidebar. Note that it works, even multiple times.
- Navigate to the next theme with either arrow or by clicking the next button.
- Try to expand/collapse the sidebar. It doesn't work.
- Navigate to the next theme. Expand/collapse does work.
- Rinse and repeat.
You can substitute closing the details view for navigating next/prev as well, same effect. Something seems to be toggling the expand/collapse ability on and off inadvertently.
Attachments (1)
Change History (8)
#2
@
10 years ago
_.once()
doesn't fix this. Why do we use it for this.nextTheme(), but not for this.previousTheme()
?
#4
@
10 years ago
- Keywords has-patch added; needs-patch removed
28581.patch fixes both the uncontrollable duplication of callbacks and the collapsing issue for me.
I'm not entirely sure what 'click .preview': 'preview'
is for (introduced in [27499]). The Preview button on Themes screen doesn't have that class, and the button on Add Themes screen doesn't require that line.
It contributes to the issue, causing themes.view.Theme.preview()
to run twice on the same click, which in turn results in themes.view.Preview.collapse()
running twice. Everything seems to work as expected without it.
this.undelegateEvents()
prevents old callbacks from firing if you close the preview and reopen it. Otherwise themes.view.Preview.collapse()
still runs multiple times.
After adding
console.log()
to themes.view.Preview.collapse(), I've noticed that it runs multiple times in a row, and that number increases each time I click Next: 2, 6, 12, 20, 30, etc.The same applies to other callbacks, probably because a new view is constructed each time you click Next or Previous. I'm not familiar enough with the code to fix it though.