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

chore(console): update incorrect swr cache key usages #5724

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Invitations() {
const { canInviteMember, canRemoveMember } = useCurrentTenantScopes();

const { data, error, isLoading, mutate } = useSWR<TenantInvitationResponse[], RequestError>(
'api/tenants/:tenantId/invitations',
`api/tenants/${currentTenantId}/invitations`,
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useEmailInputUtils = () => {
);

const { data: existingInvitations = [] } = useSWR<TenantInvitationResponse[], RequestError>(
'api/tenants/:tenantId/invitations',
`api/tenants/${currentTenantId}/invitations`,
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Members() {
const { canRemoveMember, canUpdateMemberRole } = useCurrentTenantScopes();

const { data, error, isLoading, mutate } = useSWR<TenantMemberResponse[], RequestError>(
`api/tenants/:tenantId/members`,
`api/tenants/${currentTenantId}/members`,
async () =>
cloudApi.get('/api/tenants/:tenantId/members', { params: { tenantId: currentTenantId } })
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const useTenantMembersUsage = () => {
const cloudApi = useAuthedCloudApi();

const { data: members } = useSWR<TenantMemberResponse[], RequestError>(
`api/tenants/:tenantId/members`,
`api/tenants/${currentTenantId}/members`,
async () =>
cloudApi.get('/api/tenants/:tenantId/members', { params: { tenantId: currentTenantId } })
);
const { data: invitations } = useSWR<TenantInvitationResponse[], RequestError>(
canInviteMember && 'api/tenants/:tenantId/invitations',
canInviteMember && `api/tenants/${currentTenantId}/invitations`,
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';
import { useContext, useState } from 'react';
// FIXME: @charles

Check warning on line 3 in packages/console/src/pages/TenantSettings/TenantMembers/index.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/console/src/pages/TenantSettings/TenantMembers/index.tsx#L3

[no-warning-comments] Unexpected 'fixme' comment: 'FIXME: @charles'.
// eslint-disable-next-line no-restricted-imports
import { Route, Routes } from 'react-router-dom';
import useSWRMutation from 'swr/mutation';
Expand Down Expand Up @@ -39,7 +39,7 @@
const { currentTenantId } = useContext(TenantsContext);
const cloudApi = useAuthedCloudApi();
const { trigger: mutateInvitations } = useSWRMutation(
'api/tenants/:tenantId/invitations',
`api/tenants/${currentTenantId}/invitations`,
async () =>
cloudApi.get('/api/tenants/:tenantId/invitations', { params: { tenantId: currentTenantId } })
);
Expand Down
Loading