-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(QrcodeStream): ignore structually equal prop changes
Props like `constraints` and `formats` which carry non-primitive values might receive structurally equal updates. For example, let `constraints` be the variable that is passed to `QrcodeStream`: <qrcode-stream :constraints="constraints" /> and imagine the `script` section looks like this: const constraints = ref({}) setInterval(() => { constraints.value = { deviceId: 'whatever' } }, 100) This would keep triggering updates in `QrcodeStream` although the constraints don't actually change. This is because the assigned object is referencially different every time and Vue only checks referencial equality. A less contrived example where this happens, is when the template looks like this: <qrcode-stream :constraints="{ deviceId: 'whatever' }" /> Whenever Vue re-evaluates the passed object it creates a referencially different copy. To avoid this problem we now maintain "cached" versions of these props and only update them when we detect strucural changes.
- Loading branch information
Showing
4 changed files
with
64 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": ["pnpm lint"], | ||
"**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts,json,md}": ["pnpm format"] | ||
"**/*.{vue,ts}": ["pnpm lint"], | ||
"**/*.{vue,ts,json,md}": ["pnpm format"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ pkgs.mkShell { | |
nodejs_18 | ||
nodePackages.pnpm | ||
nodePackages.typescript-language-server | ||
nodePackages.volar | ||
]; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters