chore: minor fixes and improvements

This commit is contained in:
liyasthomas
2021-10-16 20:54:19 +05:30
parent dea3a34e3d
commit 9ac1d23fd9
5 changed files with 24 additions and 32 deletions

View File

@@ -102,13 +102,13 @@ const client = createClient({
*/ */
export type GQLError<T extends string> = export type GQLError<T extends string> =
| { | {
type: "network_error" type: "network_error"
error: Error error: Error
} }
| { | {
type: "gql_error" type: "gql_error"
error: T error: T
} }
const DEFAULT_QUERY_OPTIONS = { const DEFAULT_QUERY_OPTIONS = {
noPolling: false, noPolling: false,
@@ -124,10 +124,10 @@ type UseQueryLoading = {
type UseQueryLoaded< type UseQueryLoaded<
QueryFailType extends string = "", QueryFailType extends string = "",
QueryReturnType = any QueryReturnType = any
> = { > = {
loading: false loading: false
data: E.Either<GQLError<QueryFailType>, QueryReturnType> data: E.Either<GQLError<QueryFailType>, QueryReturnType>
} }
type UseQueryReturn<QueryFailType extends string = "", QueryReturnType = any> = type UseQueryReturn<QueryFailType extends string = "", QueryReturnType = any> =
| UseQueryLoading | UseQueryLoading
@@ -218,9 +218,9 @@ export function useGQLQuery<
data: data!, data: data!,
}) as }) as
| { | {
loading: false loading: false
data: DataType data: DataType
} }
| { loading: true } | { loading: true }
} }

View File

@@ -8,7 +8,7 @@ export const resolversDef: GraphCacheResolvers = {
}), }),
user: (_parent, { uid }, _cache, _info) => ({ user: (_parent, { uid }, _cache, _info) => ({
__typename: "User", __typename: "User",
uid: uid, uid,
}), }),
}, },
} }

View File

@@ -9,9 +9,7 @@ export const updatesDef: GraphCacheUpdaters = {
}, },
(data) => { (data) => {
if (data) { if (data) {
data.myTeams = data.myTeams.filter( data.myTeams = data.myTeams.filter((x) => x.id !== teamID)
(x) => x.id !== teamID
)
} }
return data return data
@@ -20,7 +18,7 @@ export const updatesDef: GraphCacheUpdaters = {
cache.invalidate({ cache.invalidate({
__typename: "Team", __typename: "Team",
id: teamID id: teamID,
}) })
}, },
leaveTeam: (_r, { teamID }, cache, _info) => { leaveTeam: (_r, { teamID }, cache, _info) => {
@@ -30,9 +28,7 @@ export const updatesDef: GraphCacheUpdaters = {
}, },
(data) => { (data) => {
if (data) { if (data) {
data.myTeams = data.myTeams.filter( data.myTeams = data.myTeams.filter((x) => x.id !== teamID)
(x) => x.id !== teamID
)
} }
return data return data
@@ -41,7 +37,7 @@ export const updatesDef: GraphCacheUpdaters = {
cache.invalidate({ cache.invalidate({
__typename: "Team", __typename: "Team",
id: teamID id: teamID,
}) })
}, },
createTeam: (result, _args, cache, _info) => { createTeam: (result, _args, cache, _info) => {
@@ -70,11 +66,7 @@ export const updatesDef: GraphCacheUpdaters = {
.filter(([_key, uid]) => uid !== userUid) .filter(([_key, uid]) => uid !== userUid)
.map(([key]) => key) .map(([key]) => key)
cache.link( cache.link({ __typename: "Team", id: teamID }, "members", newMembers)
{ __typename: "Team", id: teamID },
"members",
newMembers
)
}, },
}, },
} }

View File

@@ -24,7 +24,7 @@
> >
<Pane class="flex flex-1 hide-scrollbar !overflow-auto"> <Pane class="flex flex-1 hide-scrollbar !overflow-auto">
<main class="flex flex-1 w-full"> <main class="flex flex-1 w-full">
<nuxt class="flex overflow-y-auto flex-1" /> <nuxt class="flex flex-1" style="overflow-y: overlay" />
</main> </main>
</Pane> </Pane>
</Splitpanes> </Splitpanes>

View File

@@ -2,7 +2,7 @@
<div> <div>
<div class="divide-y divide-dividerLight container space-y-8"> <div class="divide-y divide-dividerLight container space-y-8">
<div class="md:grid md:gap-4 md:grid-cols-3"> <div class="md:grid md:gap-4 md:grid-cols-3">
<div class="p-4 md:col-span-1"> <div class="p-8 md:col-span-1">
<h3 class="heading"> <h3 class="heading">
{{ $t("settings.theme") }} {{ $t("settings.theme") }}
</h3> </h3>
@@ -10,7 +10,7 @@
{{ $t("settings.theme_description") }} {{ $t("settings.theme_description") }}
</p> </p>
</div> </div>
<div class="space-y-8 p-4 md:col-span-2"> <div class="space-y-8 p-8 md:col-span-2">
<section> <section>
<h4 class="font-semibold text-secondaryDark"> <h4 class="font-semibold text-secondaryDark">
{{ $t("settings.background") }} {{ $t("settings.background") }}
@@ -110,7 +110,7 @@
</div> </div>
<div class="md:grid md:gap-4 md:grid-cols-3"> <div class="md:grid md:gap-4 md:grid-cols-3">
<div class="p-4 md:col-span-1"> <div class="p-8 md:col-span-1">
<h3 class="heading"> <h3 class="heading">
{{ $t("settings.interceptor") }} {{ $t("settings.interceptor") }}
</h3> </h3>
@@ -118,7 +118,7 @@
{{ $t("settings.interceptor_description") }} {{ $t("settings.interceptor_description") }}
</p> </p>
</div> </div>
<div class="space-y-8 p-4 md:col-span-2"> <div class="space-y-8 p-8 md:col-span-2">
<section> <section>
<h4 class="font-semibold text-secondaryDark"> <h4 class="font-semibold text-secondaryDark">
{{ $t("settings.extensions") }} {{ $t("settings.extensions") }}