Skip to content

Commit

Permalink
refactor: Remove unused param
Browse files Browse the repository at this point in the history
`query` is not being used inside the logic, so let's remove it
  • Loading branch information
rafaeelaudibert committed Feb 4, 2025
1 parent 24b0a76 commit 18b34f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
36 changes: 16 additions & 20 deletions frontend/src/lib/components/AuthorizedUrlList/AuthorizedUrlList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,27 @@ function EmptyState({
) : null
}

function AuthorizedUrlForm({
actionId,
experimentId,
query,
type,
allowWildCards,
}: AuthorizedUrlListProps): JSX.Element {
export interface AuthorizedUrlFormProps {
type: AuthorizedUrlListType
actionId?: number
experimentId?: ExperimentIdType
allowWildCards?: boolean
}

function AuthorizedUrlForm({ actionId, experimentId, type, allowWildCards }: AuthorizedUrlFormProps): JSX.Element {
const logic = authorizedUrlListLogic({
actionId: actionId ?? null,
experimentId: experimentId ?? null,
query: query,
type,
allowWildCards,
})
const { isProposedUrlSubmitting } = useValues(logic)
const { cancelProposingUrl } = useActions(logic)

return (
<Form
logic={authorizedUrlListLogic}
props={{ actionId, type, experimentId, query, allowWildCards }}
props={{ actionId, type, experimentId, allowWildCards }}
formKey="proposedUrl"
enableFormOnSubmit
className="w-full space-y-2"
Expand Down Expand Up @@ -118,6 +120,7 @@ export function AuthorizedUrlList({
query,
allowWildCards,
})

const {
urlsKeyed,
suggestionsLoading,
Expand Down Expand Up @@ -150,13 +153,7 @@ export function AuthorizedUrlList({
<div className="space-y-2">
{isAddUrlFormVisible && (
<div className="border rounded p-2 bg-bg-light">
<AuthorizedUrlForm
type={type}
actionId={actionId}
experimentId={experimentId}
query={query}
allowWildCards={allowWildCards}
/>
<AuthorizedUrlForm type={type} actionId={actionId} experimentId={experimentId} allowWildCards={allowWildCards} />
</div>
)}
<EmptyState
Expand Down Expand Up @@ -201,7 +198,7 @@ export function AuthorizedUrlList({
type === AuthorizedUrlListType.TOOLBAR_URLS
? launchUrl(keyedURL.url)
: // other urls are simply opened directly
`${keyedURL.url}${query ? query : ''}`
`${keyedURL.url}${query ?? ''}`
}
targetBlank
tooltip={
Expand Down Expand Up @@ -234,9 +231,8 @@ export function AuthorizedUrlList({
onClick={() => {
LemonDialog.open({
title: <>Remove {keyedURL.url} ?</>,
description: `Are you sure you want to remove this authorized ${
onlyAllowDomains ? 'domain' : 'URL'
}?`,
description: `Are you sure you want to remove this authorized ${onlyAllowDomains ? 'domain' : 'URL'
}?`,
primaryButton: {
status: 'danger',
children: 'Remove',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,12 @@ export interface AuthorizedUrlListLogicProps {
actionId: number | null
experimentId: ExperimentIdType | null
type: AuthorizedUrlListType
query: string | null | undefined
allowWildCards?: boolean
}

export const defaultAuthorizedUrlProperties = {
actionId: null,
experimentId: null,
query: null,
}

export const authorizedUrlListLogic = kea<authorizedUrlListLogicType>([
Expand Down

0 comments on commit 18b34f0

Please sign in to comment.