Do note check when hiding a component, SFJS 0.3.14

This commit is contained in:
Mo Bitar
2018-09-03 18:56:51 -05:00
parent 347ee8ddd7
commit c11fc7ce75
3 changed files with 20 additions and 7 deletions

View File

@@ -637,9 +637,22 @@ angular.module('app')
this.reloadComponentContext = function() {
// componentStack is used by the template to ng-repeat
this.componentStack = componentManager.componentsForArea("editor-stack");
for(var component of this.componentStack) {
if(component.active) {
component.hidden = !this.note || component.isExplicitlyDisabledForItem(this.note);
/*
In the past, we were doing this looping code even if the note wasn't currently defined.
The problem is if an editor stack item loaded first, requested to stream items, and the note was undefined,
we would set component.hidden = true. Which means messages would not be sent to the component.
Theoretically, upon the note loading, we would run this code again, and unhide the extension.
However, if you had requested to stream items when it was hidden, and then it unhid, it would never
resend those items upon unhiding.
Our solution here is to check that the note is defined before setting hidden. The question remains, when
would note really ever be undefined? Maybe temprarily when you're deleting a note?
*/
if(this.note) {
for(var component of this.componentStack) {
if(component.active) {
component.hidden = component.isExplicitlyDisabledForItem(this.note);
}
}
}

6
package-lock.json generated
View File

@@ -5907,9 +5907,9 @@
"dev": true
},
"standard-file-js": {
"version": "0.3.12",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.12.tgz",
"integrity": "sha512-guxocxz0ID9xYYbfC/tTxsW9Gl9ELkmI+TV17XMNVOf5eRdC3N0rBL20x2g3d8yevdi6eUIxJHa9Llx3kM/ATQ==",
"version": "0.3.14",
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.14.tgz",
"integrity": "sha512-h5jrvFe5YdyxjoiYSvLzGSFe38Arr7NOtT5vMZliMum7OkNmFJkJbLfeFJZKkvpKRpNucPTPkSIGMSxNKKt1XQ==",
"dev": true
},
"statuses": {

View File

@@ -39,7 +39,7 @@
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.2",
"sn-stylekit": "1.0.15",
"standard-file-js": "0.3.12",
"standard-file-js": "0.3.14",
"sn-models": "0.1.1",
"connect": "^3.6.6",
"mocha": "^5.2.0",