Skip to content

Commit

Permalink
Merge pull request #842 from swaroopar/feature/fixUnregisterAlert
Browse files Browse the repository at this point in the history
fix unregister alert not being removed on rerender
  • Loading branch information
iskey committed Jun 2, 2024
2 parents 550ce88 + 3fbdb5e commit 5717097
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ function ServiceProvider({
key={activeServiceDetail.id}
id={activeServiceDetail.id}
setIsViewDisabled={setIsViewDisabled}
serviceRegistrationState={activeServiceDetail.serviceRegistrationState}
/>
</div>
<h3 className={catalogStyles.catalogDetailsH3}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export function useUnregisterRequest(id: string) {
mutationFn: () => {
return ServiceVendorService.unregister(id);
},
// necessary to clear the mutationCache immediately.
// Otherwise, the mutation state is cached and with retries, it is not possible to get state of the
// latest request using useMutationState method.
gcTime: 0,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ import { CloseCircleOutlined } from '@ant-design/icons';
import { Button, Popconfirm } from 'antd';
import React from 'react';
import catalogStyles from '../../../../../styles/catalog.module.css';
import { ServiceTemplateDetailVo } from '../../../../../xpanse-api/generated';
import { useUnregisterRequest } from './UnregisterMutation';

function UnregisterService({
id,
setIsViewDisabled,
serviceRegistrationState,
}: {
id: string;
setIsViewDisabled: (isViewDisabled: boolean) => void;
serviceRegistrationState: ServiceTemplateDetailVo.serviceRegistrationState;
}): React.JSX.Element {
const unregisterRequest = useUnregisterRequest(id);

Expand All @@ -38,7 +41,10 @@ function UnregisterService({
icon={<CloseCircleOutlined />}
type='primary'
className={catalogStyles.catalogManageBtnClass}
disabled={unregisterRequest.isSuccess}
disabled={
unregisterRequest.isSuccess ||
serviceRegistrationState === ServiceTemplateDetailVo.serviceRegistrationState.UNREGISTERED
}
>
Unregister
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/components/content/order/common/FlavorPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const FlavorPrice = (): React.JSX.Element => {
<>
<Tag color={'blue'} className={serviceModifyStyles.flavorPriceContent}>
{/* TODO Will be fixed after #1597 is fixed */}
{(20).toString().concat(' ').concat('EUR/').concat('hourly')}
{(20).toString().concat(' ').concat('EUR/').concat('hour')}
</Tag>
</>
);
Expand Down

0 comments on commit 5717097

Please sign in to comment.