reactive-modal icon indicating copy to clipboard operation
reactive-modal copied to clipboard

.disabled is improperly set when reusing a settings object

Open dovrosenberg opened this issue 10 years ago • 6 comments
trafficstars

When I reuse a settings object by passing it into initDialog() and then after that dialog closes using it again to initialize a new one, the buttons all become disabled.

Perhaps this is a bad practice, as the settings object is modified by initDialog(), but it seems like it should be doable in order to limit the need to recreate the same object over and over.

In any case, the problem seems to be this line in initDialog() doesn't work if .disabled is already a ReactiveVar:

newButton.disabled = new ReactiveVar((info.buttons[button].disabled === undefined || info.buttons[button].disabled === false) ? false : true);

Perhaps it should be something like: newButton.disabled = new ReactiveVar((info.buttons[button].disabled === undefined || info.buttons[button].disabled === false || (info.buttons[button].disabled instanceof ReactiveVar && info.buttons[button].disabled.curValue===false)) ? false : true);

dovrosenberg avatar Feb 20 '15 01:02 dovrosenberg

+1 please merge the solution. I am having this same problem.

jchristman avatar Feb 21 '15 22:02 jchristman

i am busy with a personal matter for few days. can some one test this PR and confirm it?, so i can merge it. thanks in advance.

pahans avatar Feb 23 '15 06:02 pahans

Error with code. See my comments on the PR.

jchristman avatar Feb 23 '15 12:02 jchristman

@pahans, do you know when you might get a chance to publish to atmosphere? Also, I think you can close this issue now.

jchristman avatar Feb 24 '15 01:02 jchristman

@dovrosenberg, seeing as the atmosphere package was never updated with your change and another PR I made was never merged, I have created a new atmosphere package with yours and my change in it. See https://atmospherejs.com/jchristman/reactive-modal.

jchristman avatar Apr 16 '15 13:04 jchristman

Thanks, @jchristman

dovrosenberg avatar Apr 18 '15 12:04 dovrosenberg