[Glitch] Profile editing: Fix bug with reordering

Port f971670c620db61da4dadff07efe86b51c145bfd to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo 2026-03-11 13:09:54 +01:00 committed by Claire
parent 0dddc44eb5
commit 3ed3ce4e05
2 changed files with 8 additions and 5 deletions

View File

@ -212,11 +212,9 @@ export const ReorderFieldsModal: FC<DialogModalProps> = ({ onClose }) => {
return; return;
} }
newFields.push({ name: field.name, value: field.value }); newFields.push({ name: field.name, value: field.value });
void dispatch(patchProfile({ fields_attributes: newFields })).then(
onClose,
);
} }
void dispatch(patchProfile({ fields_attributes: newFields })).then(onClose);
}, [dispatch, fieldKeys, fields, onClose]); }, [dispatch, fieldKeys, fields, onClose]);
const emojis = useAppSelector((state) => state.custom_emojis); const emojis = useAppSelector((state) => state.custom_emojis);

View File

@ -221,7 +221,12 @@ export const patchProfile = createDataLoadingThunk(
`${profileEditSlice.name}/patchProfile`, `${profileEditSlice.name}/patchProfile`,
(params: Partial<ApiProfileUpdateParams>) => apiPatchProfile(params), (params: Partial<ApiProfileUpdateParams>) => apiPatchProfile(params),
transformProfile, transformProfile,
{ useLoadingBar: false }, {
useLoadingBar: false,
condition(_, { getState }) {
return !getState().profileEdit.isPending;
},
},
); );
export const selectFieldById = createAppSelector( export const selectFieldById = createAppSelector(