-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix the menu item to navigate to a form to hide when 'hidden' ticked #2426
base: main
Are you sure you want to change the base?
Conversation
Related issue #2268 |
…o users/teboho/fix-menu-item-hide
I just asked ChatGPT why this works and the hunch seems correct.. In React and state management, using 1. React State Should Be ImmutableReact relies on detecting changes in state to decide when to re-render components. If you mutate an array (e.g., using
By using 2. Functional Updates in ReactWhen updating state, React encourages immutability to avoid unintended side effects. Directly mutating the existing array (e.g., with
This ensures that the new state is derived from the previous state in an immutable way. 3. Debugging and PredictabilityMutating an array with
4. Pure Functions in State ManagementReact's state updates are designed to work best with pure functions (functions without side effects). SummaryWhen dealing with React state:
Code Comparison:Using
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your changes brokes functionality of checking form access mode.
if you want to use concat
then you should change this as itemsToCheck = itemsToCheck.concat([item]);
But with such changes, it will also not work, as it did not work before.
Btw, there is also a bug in itemsToCheck.concat(getItemsWithFormNavigation(item.childItems));
shold be
itemsToCheck = itemsToCheck.concat(getItemsWithFormNavigation(item.childItems));
The bug is in something else
fix the menu item to navigate to a form to hide when 'hidden' ticked
before:
after: