1
0
Fork 0

[DEV-5872] Catch when an element is not present

When a question has been removed, but exists in a bucket for an existing
quote, it cannot find the element to hide and it ends up showing all (or
mostly all) question elements. We are ignoring this case since the
possible side effects of ignoring them are less severe than what happens
now. Additionally, the way this works will be changing in the future.
master
Joseph Frazer 2019-09-26 13:24:39 -04:00
parent 0553060f42
commit 28cac6917f
1 changed files with 15 additions and 2 deletions

View File

@ -114,9 +114,22 @@ module.exports = Class( 'StackedGroupUi' )
if ( !this.hasVisibleField( index ) )
{
const header = this._$container.find( 'dl' )[ index ];
// This possible effects of ignoring these errors has been
// deemed less severe than the current effects when it fails
// (i.e. showing all the questions).
// This will also eventually be changed to have the elements
// be hidden by default and show when appropriate. This will
// likely fix the current issue and reduce the chances of
// something like this happening.
try {
const header = this._$container.find( 'dl' )[ index ];
header.classList.add( 'hidden' );
header.classList.add( 'hidden' );
}
catch( e )
{
console.warn( e );
}
}
},