-
Notifications
You must be signed in to change notification settings - Fork 134
Derik update/bug/2603 #4283
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
Derik update/bug/2603 #4283
Changes from 8 commits
296b3da
b4d57e9
e43d54d
4119568
8898a22
2751add
febee80
5a9e06b
db85eee
2a312f3
9ca9d69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,7 +12,7 @@ export const migrateV12toV13 = (props: ITableComponentProps, _context: SettingsM | |||||||||||||||||||
| if (typeof useMultiselect === 'boolean') { | ||||||||||||||||||||
| // If useMultiselect was true, set selectionMode to 'multiple' | ||||||||||||||||||||
| // If useMultiselect was false, set selectionMode to 'none' (no checkboxes) | ||||||||||||||||||||
| const newSelectionMode = useMultiselect ? 'multiple' : 'none'; | ||||||||||||||||||||
| const newSelectionMode = useMultiselect ? 'multiple' : 'single'; | ||||||||||||||||||||
|
Comment on lines
12
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the comment to reflect the new mapping. The comment on line 14 states "set selectionMode to 'none'" but the code now maps Apply this diff: // If useMultiselect was explicitly set
if (typeof useMultiselect === 'boolean') {
// If useMultiselect was true, set selectionMode to 'multiple'
- // If useMultiselect was false, set selectionMode to 'none' (no checkboxes)
+ // If useMultiselect was false, set selectionMode to 'single'
const newSelectionMode = useMultiselect ? 'multiple' : 'single';📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| // Remove the old useMultiselect property and set the new selectionMode | ||||||||||||||||||||
| const { useMultiselect: removed, ...propsWithoutUseMultiselect } = props; | ||||||||||||||||||||
|
|
@@ -28,6 +28,6 @@ export const migrateV12toV13 = (props: ITableComponentProps, _context: SettingsM | |||||||||||||||||||
| // ensure selectionMode has a default value | ||||||||||||||||||||
| return { | ||||||||||||||||||||
| ...props, | ||||||||||||||||||||
| selectionMode: props.selectionMode || 'none', | ||||||||||||||||||||
| selectionMode: props.selectionMode || 'single', | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,18 @@ | ||
| import { | ||
| IConfigurableActionConfiguration, | ||
| ConfigurableForm, | ||
| FormIdentifier, | ||
| IConfigurableFormComponent, | ||
| IToolboxComponent, | ||
| useAuth, | ||
| useForm, | ||
| useFormExpression, | ||
| useGlobalState, | ||
| useSidebarMenu, | ||
| useSheshaApplication, | ||
| } from '@/index'; | ||
| import { useConfigurableActionDispatcher } from '@/providers/configurableActionsDispatcher'; | ||
| import { useAvailableConstantsData } from '@/providers/form/utils'; | ||
| import { IFullAuditedEntity } from '@/publicJsApis/entities'; | ||
| import { | ||
| ButtonGroupItemProps, | ||
| IButtonGroup, | ||
|
|
@@ -76,8 +79,9 @@ const ProfileDropdown: IToolboxComponent<IProfileDropdown> = { | |
| const { loginInfo, logoutUser } = useAuth(); | ||
| const { formData } = useForm(); | ||
| const { globalState } = useGlobalState(); | ||
| const { executeActionViaConfiguration } = useFormExpression(); | ||
| const { executeAction } = useConfigurableActionDispatcher(); | ||
| const { anyOfPermissionsGranted } = useSheshaApplication(); | ||
| const allData = useAvailableConstantsData(); | ||
|
|
||
| const sidebar = useSidebarMenu(false); | ||
| const { accountDropdownListItems } = sidebar || {}; | ||
|
|
@@ -138,7 +142,17 @@ const ProfileDropdown: IToolboxComponent<IProfileDropdown> = { | |
| return (isItem(item) && isVisibleBase(item)) || (isGroup(item) && isGroupVisible(item, getIsVisible)); | ||
| }; | ||
|
|
||
| const menuItems = getMenuItem(finalItems, executeActionViaConfiguration, getIsVisible); | ||
| // Custom execute function that includes dynamicItem in the context | ||
| const executeActionWithDynamicContext = (actionConfiguration: IConfigurableActionConfiguration, dynamicItem?: IFullAuditedEntity): void => { | ||
| if (actionConfiguration) { | ||
| executeAction({ | ||
| actionConfiguration, | ||
| argumentsEvaluationContext: { ...allData, dynamicItem }, | ||
| }); | ||
| } | ||
| }; | ||
|
Comment on lines
+145
to
+153
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Dynamic context wrapper is correct; consider stabilizing with The
To avoid unnecessary re-renders in consumers that might depend on function identity, you could optionally wrap this helper in - const executeActionWithDynamicContext = (actionConfiguration: IConfigurableActionConfiguration, dynamicItem?: IFullAuditedEntity): void => {
- if (actionConfiguration) {
- executeAction({
- actionConfiguration,
- argumentsEvaluationContext: { ...allData, dynamicItem },
- });
- }
- };
+ const executeActionWithDynamicContext = React.useCallback(
+ (actionConfiguration: IConfigurableActionConfiguration, dynamicItem?: IFullAuditedEntity): void => {
+ if (!actionConfiguration) return;
+ executeAction({
+ actionConfiguration,
+ argumentsEvaluationContext: { ...allData, dynamicItem },
+ });
+ },
+ [executeAction, allData],
+ );Not mandatory unless downstream memoization depends on a stable callback. 🤖 Prompt for AI Agents |
||
|
|
||
| const menuItems = getMenuItem(finalItems, executeActionWithDynamicContext, getIsVisible); | ||
|
|
||
| const accountMenuItems = getAccountMenuItems(accountDropdownListItems, logoutUser); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.