Skip to content

fix: fixed side menu items visibility#4698

Merged
IvanIlyichev merged 1 commit intomainfrom
fix/side-menu-fix
Mar 26, 2026
Merged

fix: fixed side menu items visibility#4698
IvanIlyichev merged 1 commit intomainfrom
fix/side-menu-fix

Conversation

@IvanIlyichev
Copy link
Contributor

@IvanIlyichev IvanIlyichev commented Mar 26, 2026

Summary by CodeRabbit

  • Refactor
    • Improved menu item state management with better tracking of menu changes and enhanced reliability of permission-based menu visibility handling.

@IvanIlyichev IvanIlyichev merged commit cfdcbe3 into main Mar 26, 2026
1 of 2 checks passed
@IvanIlyichev IvanIlyichev deleted the fix/side-menu-fix branch March 26, 2026 09:46
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 629707d0-b659-4008-8e53-1882bd02c6d7

📥 Commits

Reviewing files that changed from the base of the PR and between ab60d14 and 5465edd.

📒 Files selected for processing (4)
  • shesha-reactjs/src/providers/mainMenu/actions.ts
  • shesha-reactjs/src/providers/mainMenu/contexts.ts
  • shesha-reactjs/src/providers/mainMenu/index.tsx
  • shesha-reactjs/src/providers/mainMenu/reducer.ts

Walkthrough

The main menu provider is refactored to track both current and original menu items separately, replacing mutable reference-based state management with immutable reducer actions while preventing in-place mutations through structural cloning.

Changes

Cohort / File(s) Summary
Action & State Definition
shesha-reactjs/src/providers/mainMenu/actions.ts, shesha-reactjs/src/providers/mainMenu/contexts.ts
Added SetItemsActionPayload type containing both items and originalItems, updated setItemsAction signature, and extended IMainMenuStateContext with optional originalItems property to track original menu state.
State Management
shesha-reactjs/src/providers/mainMenu/reducer.ts, shesha-reactjs/src/providers/mainMenu/index.tsx
Refactored reducer to destructure new payload structure into separate state properties; replaced mutable useRef flow in provider with immutable updates, introduced cloneDeep for form-permission logic to prevent mutations, and updated initial state dispatches to include both items and originalItems.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A hop through the menu, now pristine and clear,
No mutations to fear, with items held dear,
Original kept safe, copies dance free,
Immutable state—how it ought to be! 🌿✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/side-menu-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant