Skip to content

fix: workflow auto-save button permission error - #8197

Merged
peslyn merged 1 commit into
v3from
pr@v3@fix_workflow_auto_save_button_permission_error
Nov 27, 2026
Merged

peslyn merged 1 commit into
v3from
pr@v3@fix_workflow_auto_save_button_permission_error

Conversation

@shaohuzhang1

Copy link
Copy Markdown
Contributor

fix: workflow auto-save button permission error

<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" />

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Permission Function Caching/Performance:
    If applicationWorkflowPermission('edit') is called frequently (e.g., on every re-render), ensure it’s cheap or memoized. Consider computing it once in a computed property:

    const canEdit = computed(() => applicationWorkflowPermission('edit'));

    Then use v-if="canEdit" in the template.

  2. Consistency:
    Ensure other edit-related actions in this dropdown/menu also use the same permission check for consistent UX.

  3. Event Handler Logic:
    Confirm that if permissions change dynamically (e.g., user role changes mid-session), Vue reactivity properly updates visibility. The above computed ensures this.

  4. Minor UX Note:
    Hiding the entire <MkDropdownItem> may cause layout shifts in the menu. If only the switch should be disabled, consider using :checked + disabled instead of hiding the whole item.

Overall: The change is logically sound, just optimize performance and verify consistency/reaction to dynamic permission states.

@peslyn
peslyn merged commit bae95eb into v3 Nov 27, 2026
3 of 4 checks passed
@peslyn
peslyn deleted the pr@v3@fix_workflow_auto_save_button_permission_error branch November 27, 2026 05:50
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