Skip to content

Commit

Permalink
fix: Avoid infinite loading on saving error
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 authored and JanCizmar committed Jun 9, 2022
1 parent d285c01 commit c26d94c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
11 changes: 2 additions & 9 deletions webapp/src/views/projects/translations/cell/ControlsEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React from 'react';
import { T } from '@tolgee/react';
import { Button, styled } from '@mui/material';
import { CameraAlt } from '@mui/icons-material';
Expand Down Expand Up @@ -52,13 +52,6 @@ export const ControlsEditor: React.FC<ControlsProps> = ({

const isEditLoading = useTranslationsSelector((c) => c.isEditLoading);

const [isLoading, setIsLoading] = useState(isEditLoading);
useEffect(() => {
if (isEditLoading && !isLoading) {
setIsLoading(true);
}
}, [isEditLoading]);

return (
<>
<StyledLeftPart>
Expand All @@ -76,7 +69,7 @@ export const ControlsEditor: React.FC<ControlsProps> = ({
color="primary"
variant="contained"
size="small"
loading={isLoading}
loading={isEditLoading}
data-cy="translations-cell-save-button"
>
<T>translations_cell_save</T>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTranslate, T } from '@tolgee/react';
import { T } from '@tolgee/react';
import { useQueryClient } from 'react-query';
import { container } from 'tsyringe';

Expand All @@ -21,7 +21,6 @@ export const useTagsService = ({ translations }: Props) => {
const putTag = usePutTag();
const deleteTag = useDeleteTag();
const project = useProject();
const t = useTranslate();

const removeTag = (data: RemoveTag) =>
deleteTag
Expand Down

0 comments on commit c26d94c

Please sign in to comment.