Skip to content

Commit 7d59b6c

Browse files
committed
refactor: improve performance & keep consistency
1 parent c2c4f88 commit 7d59b6c

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/plugin-slots/ExtendedProfileFieldsSlot/README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,21 @@ import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-frame
2828
import { ExtendedProfileFields } from '@organization/frontend-component-extended-fields';
2929

3030
const config = {
31-
pluginSlots: {
32-
extended_profile_fields_slot: {
33-
keepDefault: false,
34-
plugins: [
35-
{
36-
// Insert a custom ExtendedProfileFields component
37-
op: PLUGIN_OPERATIONS.Insert,
38-
widget: {
39-
id: 'extended_profile_fields',
40-
type: DIRECT_PLUGIN,
41-
RenderWidget: ExtendedProfileFields,
42-
},
43-
},
44-
],
45-
},
46-
},
31+
pluginSlots: {
32+
extended_profile_fields_slot: {
33+
keepDefault: false,
34+
plugins: [
35+
{
36+
op: PLUGIN_OPERATIONS.Insert,
37+
widget: {
38+
id: 'extended_profile_fields',
39+
type: DIRECT_PLUGIN,
40+
RenderWidget: ExtendedProfileFields,
41+
},
42+
},
43+
],
44+
},
45+
},
4746
};
4847

4948
export default config;

src/plugin-slots/ExtendedProfileFieldsSlot/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { PluginSlot } from '@openedx/frontend-plugin-framework';
22
import { useDispatch, useSelector } from 'react-redux';
33

4+
import { useCallback } from 'react';
45
import { patchProfile } from '../../profile/data/services';
56
import { fetchProfile } from '../../profile/data/actions';
67

@@ -13,7 +14,7 @@ const ExtendedProfileFieldsSlot = () => {
1314
const extendedProfileValues = useSelector((state) => state.profilePage.account.extendedProfile);
1415

1516
const pluginProps = {
16-
refreshUserProfile: (username) => dispatch(fetchProfile(username)),
17+
refreshUserProfile: useCallback((username) => dispatch(fetchProfile(username)), [dispatch]),
1718
updateUserProfile: patchProfile,
1819
profileFieldValues: extendedProfileValues,
1920
formComponents: {

0 commit comments

Comments
 (0)