Skip to content

Commit

Permalink
chore: cleanup - remove unused server error handling on joincommunity…
Browse files Browse the repository at this point in the history
… modal
  • Loading branch information
EmiM committed Apr 23, 2024
1 parent 093daee commit d451c2e
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,7 @@ const args: PerformCommunityActionProps = {
revealInputValue: false,
}

const serverErrorArgs: PerformCommunityActionProps = {
...args,
serverErrorMessage: 'Could not connect to the server',
clearServerError: function (): void {
console.log('Clearing server error message')
},
}

Component.args = args
ServerError.args = serverErrorArgs

const component: ComponentMeta<typeof PerformCommunityActionComponent> = {
title: 'Components/JoinCommunity',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ const JoinCommunity = () => {

const torBootstrapProcessSelector = useSelector(connection.selectors.torBootstrapProcess)

const downloadInviteDataError = useSelector(
errors.selectors.generalErrorByType(SocketActionTypes.DOWNLOAD_INVITE_DATA)
)

const [revealInputValue, setRevealInputValue] = useState<boolean>(false)
const [serverErrorMessage, setServerErrorMessage] = useState<string>('')

useEffect(() => {
if (isConnected && !currentCommunity && !joinCommunityModal.open) {
Expand Down Expand Up @@ -57,19 +52,6 @@ const JoinCommunity = () => {
}
}

useEffect(() => {
if (downloadInviteDataError?.message) {
setServerErrorMessage(downloadInviteDataError.message)
}
}, [downloadInviteDataError])

const clearServerError = () => {
if (downloadInviteDataError) {
dispatch(errorsState.actions.clearError(downloadInviteDataError))
setServerErrorMessage('')
}
}

const handleClickInputReveal = () => {
revealInputValue ? setRevealInputValue(false) : setRevealInputValue(true)
}
Expand All @@ -85,8 +67,6 @@ const JoinCommunity = () => {
hasReceivedResponse={Boolean(currentIdentity && !currentIdentity.userCertificate)}
revealInputValue={revealInputValue}
handleClickInputReveal={handleClickInputReveal}
serverErrorMessage={serverErrorMessage}
clearServerError={clearServerError}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ export interface PerformCommunityActionProps {
hasReceivedResponse: boolean
revealInputValue?: boolean
handleClickInputReveal?: () => void
serverErrorMessage?: string
clearServerError?: () => void
}

export const PerformCommunityActionComponent: React.FC<PerformCommunityActionProps> = ({
Expand All @@ -152,8 +150,6 @@ export const PerformCommunityActionComponent: React.FC<PerformCommunityActionPro
hasReceivedResponse,
revealInputValue,
handleClickInputReveal,
serverErrorMessage,
clearServerError,
}) => {
const [formSent, setFormSent] = useState(false)

Expand All @@ -178,14 +174,6 @@ export const PerformCommunityActionComponent: React.FC<PerformCommunityActionPro
mode: 'onTouched',
})

useEffect(() => {
if (serverErrorMessage) {
setError('name', { message: serverErrorMessage })
setFormSent(false)
clearServerError?.()
}
}, [serverErrorMessage])

const onSubmit = (values: PerformCommunityActionFormValues) => submitForm(handleCommunityAction, values, setFormSent)

const submitForm = (
Expand Down
1 change: 0 additions & 1 deletion packages/state-manager/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export interface EmitEvents {
[SocketActionTypes.CREATE_NETWORK]: EmitEvent<string, (response: NetworkInfo | undefined) => void>
[SocketActionTypes.ADD_CSR]: EmitEvent<SaveCSRPayload>
[SocketActionTypes.SET_USER_PROFILE]: EmitEvent<UserProfile>
[SocketActionTypes.DOWNLOAD_INVITE_DATA]: EmitEvent<{ serverAddress: string; cid: string }>
[SocketActionTypes.LOAD_MIGRATION_DATA]: EmitEvent<Record<string, any>>
}

Expand Down
1 change: 0 additions & 1 deletion packages/types/src/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export enum SocketActionTypes {
COMMUNITY_LAUNCHED = 'communityLaunched',
COMMUNITY_UPDATED = 'communityUpdated',
CREATE_COMMUNITY = 'createCommunity',
DOWNLOAD_INVITE_DATA = 'downloadInviteData',
LAUNCH_COMMUNITY = 'launchCommunity',
LEAVE_COMMUNITY = 'leaveCommunity',

Expand Down

0 comments on commit d451c2e

Please sign in to comment.