-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array Property not converted to ReactiveArray when using ViewModel inside IFRAME #292
Comments
I can't check it right now but I'm pretty sure ReactiveArray doesn't work across IFrames due to the moronic decision I made like 5 years ago when I decided to extend JS Arrays. |
I'm trying to build a component browser (like Chromatic or Storybook) for Blaze and ViewModel, which is why I hope for ViewModel to work inside |
I'll see what I can do. |
Other weirdness probably related to using an IFRAME. Seems I cannot access a component's value by reference from a helper, like so: <template name="parent">
{{> component ref='childComponent' }}
<span>{{valueFromChild}}</span>
</template> Template.parent.viewmodel({
valueFromChild() {
return this.childComponent.value();
}
} but I can like so: <template name="parent">
{{> component ref='childComponent' }}
<span {{b "text: childComponent.value"}}></span>
</template> The weirdest thing is, if I write this in a helper: Template.parent.viewmodel({
log() {
console.log(this) // Prints out ViewModel with props, one of them the reference to 'childComponent' (ViewModel)
console.log(this.childComponent) // Prints out undefined
}
} |
Okay, I fixed the array issue. Update VM to 6.3.3 and ReactiveArray to 1.0.6 (if you have a direct reference). Please make a repro for the parent/child issue. |
This is great and it seems to fix the issue, thanks! I'll try to build a repro for the referencing issue. |
I'm reopening this since there's still something funny going on with IFRAME's. In certain scenarios, ViewModel somehow "mangles" Objects in a way I do not quite understand. Suddenly for example Repro:https://github.com/arggh/viewmodel-iframe-issue/tree/object-issue How to:
|
This has to be the most absurd, far fetched edge case scenario this repository has seen so far, but here goes:
IFRAME
, rendered with same initial properties, the Array prop does not get converted toReactiveArray
.Reproduction here: https://github.com/arggh/viewmodel-iframe-issue
I tried to make it as simple as possible while still explaining the issue properly. I had to include a router for the
IFRAME
to work.The text was updated successfully, but these errors were encountered: