Skip to content

Commit

Permalink
cci(csr): fix section restart
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed Sep 2, 2024
1 parent 53aeea2 commit 4ba611c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ui/root/DeputyContributionSurveySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
/**
* Toggle section elements. Removes the section elements (but preservers them in
* `this.sectionElements`) if `false`, re-appends them to the DOM if `true`.
*
* @param toggle
*/
toggleSectionElements( toggle: boolean ) {
Expand Down Expand Up @@ -706,7 +707,15 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
const heading = this.heading.root;
const insertRef = heading.nextSibling ?? null;
for ( const child of Array.from( element.childNodes ) ) {
if ( !this.casePage.isContributionSurveyHeading( child ) ) {
if ( !this.casePage.isContributionSurveyHeading(
normalizeWikiHeading(
child,
// We're using elements that aren't currently appended to the
// DOM, so we have to manually set the ceiling. Otherwise, we'll
// get the wrong element and ceiling checks will always be false.
element
)?.h,
) ) {
heading.parentNode.insertBefore( child, insertRef );
this.sectionNodes.push( child as HTMLElement );
// noinspection JSUnresolvedReference
Expand Down

0 comments on commit 4ba611c

Please sign in to comment.