Repository navigation
fix: workflow auto-save button permission error - #8197
Conversation
| <MkDropdownItem v-if="applicationWorkflowPermission('edit')" @click.stop> | ||
| <template #icon><MkIcon name="icon_save_outlined" /></template> | ||
| <span>{{ t('workflow.layout.autoSave') }}</span> | ||
| <el-switch v-model="autoSaveEnabled" class="ml-auto" size="small" @click.stop @change="handleAutoSaveChange" /> |
There was a problem hiding this comment.
This diff adds a permission check (v-if) to the "Auto-save" UI element, which is good for security and UX. However, here are potential issues and improvements:
-
Permission Function Caching/Performance:
IfapplicationWorkflowPermission('edit')is called frequently (e.g., on every re-render), ensure it’s cheap or memoized. Consider computing it once in acomputedproperty:const canEdit = computed(() => applicationWorkflowPermission('edit'));
Then use
v-if="canEdit"in the template. -
Consistency:
Ensure other edit-related actions in this dropdown/menu also use the same permission check for consistent UX. -
Event Handler Logic:
Confirm that if permissions change dynamically (e.g., user role changes mid-session), Vue reactivity properly updates visibility. The abovecomputedensures this. -
Minor UX Note:
Hiding the entire<MkDropdownItem>may cause layout shifts in the menu. If only the switch should be disabled, consider using:checked+disabledinstead of hiding the whole item.
Overall: The change is logically sound, just optimize performance and verify consistency/reaction to dynamic permission states.
fix: workflow auto-save button permission error