Skip to content

fix(ui): set disable prop default to false quasarframework#17945 #17962

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

Conversation

SamVanini
Copy link
Contributor

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Documentation
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the dev branch (or v[X] branch)
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)
  • It's been tested on a Cordova (iOS, Android) app
  • It's been tested on an Electron app
  • Any necessary documentation has been added or updated in the docs or explained in the PR's description.

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to start a new feature discussion first and wait for approval before working on it)

Other information:
This PR aims to solve the bug described in issue #17945, setting a false default for disable prop.
As per Vue docs, all props are optional by default and an absent prop other than Boolean will have undefined value. In this scenario, a Boolean prop willl be cast to false, unless an undefined value is explicitly passed.
Setting a default to false prevents hybrid behaviours described in the linked issue because false value (our default) will be used if the resolved value is undefined, including both when the prop is missing or explicit undefined is passed

Further reference can be found in the aforementioned doc: https://vuejs.org/guide/components/props.html#prop-validation

Copy link

github-actions bot commented Apr 8, 2025

Build Results

JSON API

📜 Changes detected:

diff --git a/./current-build/api/QChip.json b/./pr-build/api/QChip.json
index 0b7997a..651d686 100644
--- a/./current-build/api/QChip.json
+++ b/./pr-build/api/QChip.json
@@ -192,7 +192,9 @@
     "disable": {
       "type": "Boolean",
       "desc": "Put component in disabled mode",
-      "category": "state"
+      "category": "state",
+      "default": "false",
+      "required": false
     }
   },
   "slots": {

Types

📜 Changes detected:

diff --git a/./current-build/types/index.d.ts b/./pr-build/types/index.d.ts
index 06232b6..cbce5a9 100644
--- a/./current-build/types/index.d.ts
+++ b/./pr-build/types/index.d.ts
@@ -5068,6 +5068,7 @@ export interface QChipProps {
   tabindex?: number | string | undefined;
   /**
    * Put component in disabled mode
+   * Default value: false
    */
   disable?: boolean | undefined;
   /**

Copy link

github-actions bot commented Apr 8, 2025

UI Tests Results

    1 files     98 suites   39s ⏱️
1 031 tests 1 031 ✅ 0 💤 0 ❌
1 050 runs  1 050 ✅ 0 💤 0 ❌

Results for commit 2f0cdf9.

@rstoenescu
Copy link
Member

Hi,

First of all, thank you for contributing with a PR!

In Vue, the default value for a Boolean prop is already false. However, you can use the prop in two forms when writing your vue template:

<q-chip :disable="true" />
<q-chip disable />

<!-- the following is implied already -->
<q-chip :disable="false" /> is equivalent to <q-chip /> 

Should you need to specify the prop explicitly all the time then assign it to either true or false.

@rstoenescu rstoenescu closed this Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants