1.0.0-beta.29
https://github.com/rndmerle/repro-vue-test-utils-sync/tree/setprops-watcher
git clone -b setprops-watcher https://github.com/rndmerle/repro-vue-test-utils-sync.git
yarn && yarn test
Hello test passing, with logging on console:
foo undefined
foo xxx
Hello test not passing, with logging on console:
foo undefined
To make the test pass, either:
I'm getting this as well. This occurs also even if you aren't watching the prop directly, but are watching a computed prop that uses the prop. I made an example repo off of yours, install instructions are the same:
https://github.com/DoubleB123/repro-vue-test-utils-sync/tree/computed
I also occured this bug when watch for prop change after call setProps watcher isn't called
I am having this same issue, has anyone found a successful workaround?
I found the core reason for that :)
When we have component with watcher for immediate: true watcher Vue dependency system will track dependency from our component to parent component, which renders our own one. This effectively means, that as soon as we explicitly set prop on the component with setProps - our component will be immediately re-rendered with original props by our parent component
I've created #1300 to address this issue and added original failed test
Nice find!
@Dayna-A and everyone looking for a workaround,
for me calling the following code worked, after mounting a component:
wrapper = mount(MyComponent, options);
wrapper.vm.$parent.$forceUpdate();
await wrapper.vm.$nextTick();
I'm initializing the component in
beforeEach(async function () {
(please note async)
@bugy Thank you! This solved my problem with setProps()!
Most helpful comment
@Dayna-A and everyone looking for a workaround,
for me calling the following code worked, after mounting a component:
I'm initializing the component in
(please note
async)