vue icon indicating copy to clipboard operation
vue copied to clipboard

`$forceUpdate` do not update checked status of checkbox-

Open xiaodemen opened this issue 5 years ago • 8 comments

Version

2.6.10

Reproduction link

https://jsfiddle.net/ahy27vu3/

Steps to reproduce

  1. input[type="text"] value is forced to '', which is controlled completely
  2. input[type="checkbox"] checked does not work

What is expected?

input[type="checkbox"] checked is forced to false

What is actually happening?

input[type="checkbox"] checked keep the value last entered


Maybe this is designed on purpose,Could you please explain why? https://github.com/vuejs/vue/blob/dev/src/platforms/web/runtime/modules/dom-props.js#L67 https://github.com/vuejs/vue/blob/dev/src/platforms/web/runtime/modules/dom-props.js#L42

xiaodemen avatar Sep 10 '19 10:09 xiaodemen

Please see https://github.com/vuejs/vue/issues/9535 and https://github.com/vuejs/vue/issues/9340

posva avatar Sep 10 '19 11:09 posva

@posva This issue has nothing to do with micro/macro task

xiaodemen avatar Sep 10 '19 11:09 xiaodemen

@posva I believe what @xiaodemen want is to implement a “fully controlled” checkbox.

Justineo avatar Sep 10 '19 12:09 Justineo

It is related to micro/macro task though as it used to work on 2.5

I'm realising the $forceUpdate doesn't work anymore though and that is a problem

posva avatar Sep 10 '19 12:09 posva

@posva It is not related to micro/macro task, see: https://github.com/vuejs/vue/blob/v2.6.0/src/platforms/web/runtime/modules/dom-props.js#L45

xiaodemen avatar Sep 10 '19 12:09 xiaodemen

You're probably both "right". The change that you link to, @xiaodemen, was done because it was expected that the check for "checked" should no longer be necessary after we did the microtaks changes in 2.6. But appearantly that's not always the caase.

LinusBorg avatar Sep 10 '19 12:09 LinusBorg

I know this issue is pretty old, and it might even have gotten fixed in Vue 3, but is there any chance it will be looked at at some point? 😇

benface avatar Jan 19 '21 05:01 benface

I've faced with the similar issue. $forceUpdate doesn't work if element (even text input) is wrapped inside custom component.

Minimal example: https://sfc.vuejs.org/#eNqNVMGOmzAQ/ZVZVIlE2mD1miYrrXJpq17bXnyhMCRsjY08A2kV8e8d24Qke2oOgbHH772Z5+GSvfZ9MQ6YbbMdVb7t+UXbtuudZzi4rofGuw7yQoUgJOaftAXQFv/EnBqbcjAMl7BaSY6zaJm2aQEixnN4neJ/XXK5Wl83PfLg7TXSPJZmwC3kn9EYBz+dN/VTnjanSJtAAs3AWM8kmlsr8Y90eAYDOCLfmO7Y+NRSEZkiZASPsOFHcijuPZxUCg4DsTTCuGNbATtoWsPoobS1ch46V7fNXxhIlqKY29kbHewhPgt239wZ/aEkXK0Lj70pK1wprUkdnyHP14swgLaBJAie9vs7sAd9UWHjfIVS5MajrUWHiCQWQ4F6gaf77AjzIR743oslIuOOclraMrc+2J2aFFzYqeWeSMDYiXxGiQB2p48vVxsuqRExhGnaKdmLOX18ALwaAwZZukhQehRX7YhebA3KTWgQVNKh0OK5hJjmsXMj1kXEUglMML+KP4kRVveVwdn537ReMlPKuBHH0Ox1dhOpsyvWl5jTWmprkZWMX672O/jaIdmcI82NJdz6ucz/YIyzJa87tXQze87SEG66si/eyFkZ0HTb5w3S2XLZdSaDGWKdnZh72ipFTRWm9Y0K549K3go/WG47LJC6zS/vznJXBVhn0VuxViivMx4+Bo/G1u0IlSmJpIDUkVm87JFxDGouRRLfVTL9A4ovbM4=

mahnunchik avatar Feb 21 '23 14:02 mahnunchik