Skip to content

changed disabled flag for menu items to only work in production envir…#893

Open
charming-wicket-5502 wants to merge 1 commit intodevelopfrom
fix-attempt
Open

changed disabled flag for menu items to only work in production envir…#893
charming-wicket-5502 wants to merge 1 commit intodevelopfrom
fix-attempt

Conversation

@charming-wicket-5502
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Sidebar menu-item disabling logic so that Create/Import entries are only conditionally disabled (based on access rights) when the UI is running in production mode, allowing unrestricted behavior in non-production environments.

Changes:

  • Introduces a production-environment guard (import.meta.env.MODE === ...) around the Create/Import disabled-state logic.
  • Keeps existing access-rights evaluation (hasCreateAccess) but applies it only when the production guard is true.


// // Handle disabled state based on access rights
if (isCreateItem || isImportItem) {
const isProduction = import.meta.env.MODE === 'production';
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

This introduces single quotes for the MODE comparison, but the UI is formatted with Prettier configured for double quotes (ui/.prettierrc.json sets singleQuote: false). This will cause pnpm run check (prettier --check) to fail unless the string literal is switched to double quotes (or the file is reformatted).

Suggested change
const isProduction = import.meta.env.MODE === 'production';
const isProduction = import.meta.env.MODE === "production";

Copilot uses AI. Check for mistakes.
Comment on lines +44 to 48
const isProduction = import.meta.env.MODE === 'production';

// Handle disabled state based on access rights
if (isProduction && (isCreateItem || isImportItem)) {
newItem.disabled = !hasCreateAccess;
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

isProduction is invariant for all menu items but is recomputed inside items.map(...) (and again for each recursive child). Consider computing it once outside processItems (or at least once per processMenuItems call) to avoid unnecessary repeated work and to make the intent clearer.

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +47
// Handle disabled state based on access rights
if (isProduction && (isCreateItem || isImportItem)) {
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The inline comment "Handle disabled state based on access rights" is now slightly inaccurate because the disabled state is only applied in production. Update the comment to reflect the production-only behavior to avoid confusion during local development/debugging.

Copilot uses AI. Check for mistakes.
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