Skip to content

Commit facefa9

Browse files
committed
wip
1 parent 8457cad commit facefa9

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

front/src/applications/editor/Editor.tsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ const Editor = () => {
6565
}, [setRenderingFingerprint]);
6666

6767
const [isFormSubmited, setIsFormSubmited] = useState(false);
68-
const [getInfraById, { data: infra }] = osrdEditoastApi.endpoints.getInfraById.useLazyQuery({});
68+
const { data: infra } = osrdEditoastApi.endpoints.getInfraById.useQuery(
69+
{ id: infraID as number },
70+
{
71+
skip: !infraID,
72+
}
73+
);
6974
const { updateInfra } = useInfraActions();
7075

7176
const switchTool = useCallback(
@@ -314,12 +319,6 @@ const Editor = () => {
314319
}
315320
}, [toolAndState.state.entity?.properties.id]);
316321

317-
useEffect(() => {
318-
if (infraID) {
319-
getInfraById({ id: infraID });
320-
}
321-
}, [infraID, getInfraById]);
322-
323322
useEffect(() => {
324323
if (infra) {
325324
dispatch(updateInfra(infra));

front/src/applications/editor/tools/rangeEdition/tool-factory.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ function getRangeEditionTool<T extends EditorRange>({
9797
id: `save-${objectTypeAction}`,
9898
icon: AiFillSave,
9999
labelTranslationKey: `Editor.tools.${objectTypeEdition}-edition.actions.save-${objectTypeAction}`,
100-
isDisabled({ isLoading, isInfraLocked, state }) {
100+
isDisabled({ isLoading, state }) {
101101
if (isLoading) return true;
102102
if (canSave) return !canSave(state);
103-
return !!isInfraLocked;
104103
},
105104
async onClick({ state, setState, dispatch, infraID }) {
106105
const { initialEntity, entity } = state;

0 commit comments

Comments
 (0)