Skip to content
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

Disable Lift export when Frontier is empty #3440

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

andracc
Copy link
Collaborator

@andracc andracc commented Nov 11, 2024

Resolves #3441

This change is Reviewable

Copy link

codecov bot commented Nov 11, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.64%. Comparing base (7f23e66) to head (ca8b1d6).

Files with missing lines Patch % Lines
src/components/ProjectExport/ExportButton.tsx 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3440      +/-   ##
==========================================
+ Coverage   74.58%   74.64%   +0.05%     
==========================================
  Files         285      285              
  Lines       10999    11003       +4     
  Branches     1339     1339              
==========================================
+ Hits         8204     8213       +9     
+ Misses       2410     2405       -5     
  Partials      385      385              
Flag Coverage Δ
backend 83.62% <ø> (+0.07%) ⬆️
frontend 66.66% <62.50%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 2 files at r2, all commit messages.
Reviewable status: 1 of 2 files reviewed, 3 unresolved discussions (waiting on @andracc)


src/components/ProjectExport/ExportButton.tsx line 16 at r2 (raw file):

  projectId: string;
  buttonProps?: ButtonProps & { "data-testid"?: string };
  disabled?: boolean;

It looks like this new optional prop isn't been used.


src/components/ProjectExport/ExportButton.tsx line 22 at r2 (raw file):

export default function ExportButton(props: ExportButtonProps): ReactElement {
  const dispatch = useAppDispatch();
  const [exports, setExports] = useState<boolean>(false);

The <boolean> can be dropped, since the type is implied from the default value.


src/components/ProjectExport/ExportButton.tsx line 43 at r2 (raw file):

          setExports(true);
        }
      });

Because setExports is a function that takes a boolean, you should be able to condense this to

await isFrontierNonempty(props.propjectId).then(setExports);

(There's no performance concern for updating a state to what it already is, because rerenders are only triggered when states and props change.)


src/components/ProjectExport/ExportButton.tsx line 53 at r2 (raw file):

        <LoadingButton
          loading={loading}
          disabled={loading}

Since the LoadingButton has a disabled prop, probably better to update that with loading || !exports than to conflict with it via the buttonProps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable export button when frontier is empty
2 participants