Enhance BranchSelection component to force re-render on branch list change
- Added a computed property `branchesKey` to generate a unique key based on branch IDs, ensuring the dropdown re-renders when the branch list updates. - Updated the FormattedDropdown component to utilize this key for improved responsiveness to data changes.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
<h3>{{ $t('falukant.branch.selection.title') }}</h3>
|
<h3>{{ $t('falukant.branch.selection.title') }}</h3>
|
||||||
<div>
|
<div>
|
||||||
<FormattedDropdown
|
<FormattedDropdown
|
||||||
|
:key="branchesKey"
|
||||||
:options="branches"
|
:options="branches"
|
||||||
:columns="branchColumns"
|
:columns="branchColumns"
|
||||||
v-model="localSelectedBranch"
|
v-model="localSelectedBranch"
|
||||||
@@ -54,6 +55,12 @@ export default {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
// Erzwingt ein Neu-Rendern des Dropdowns, wenn sich die Branch-Liste ändert
|
||||||
|
branchesKey() {
|
||||||
|
return this.branches.map(b => b.id).join('-');
|
||||||
|
},
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectedBranch(newVal) {
|
selectedBranch(newVal) {
|
||||||
this.localSelectedBranch = newVal;
|
this.localSelectedBranch = newVal;
|
||||||
|
|||||||
Reference in New Issue
Block a user