vuetifyjs / vuetifyjs/vuetify

[Bug Report][4.0.1] v-switch: Next click event not fired if writable computed setter doesn't update the source of truth

Open
#22,689 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C: VSwitch S: triage
Dominant language
TypeScript
Stars
41k
Forks
7.1k
Avg merge
1d 21h
Merged PRs (30d)
11

Description

Environment

Vuetify Version: 4.0.1
Vue Version: 3.5.29
OS: macOS 10.15 (current)

Steps to reproduce
  1. Create a v-switch with a v-model bound to a writable computed.
  2. In the set method of the computed, add a condition that prevents updating the original ref.
  3. Click the switch and cancel confirm. The switch stays in its original position (Correct).
  4. Click the switch again.
Expected Behavior

The second click should immediately trigger the set method of the computed property again.

Actual Behavior

When binding a v-switch to a writable computed property, if the set function logic decides not to update the underlying reactive state (the source of truth), the v-switch visually reflects the correct state (it doesn't toggle), but it seems to get stuck. The next immediate click on the switch does nothing and triggers no events. A second click is required to make it work again.

Reproduction Link

https://play.vuetifyjs.com/#...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked reproduction with Vuetify 4.0.1 and tracing v-switch handling for a writable computed v-model whose setter does not update its source ref. Confirm the fix by ensuring the second immediate click invokes the computed setter again while the switch remains in its original state when the update is rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.