Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
holi-frontends
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
app
holi-frontends
Commits
2c80d3cc
Commit
2c80d3cc
authored
3 weeks ago
by
scerelli
Browse files
Options
Downloads
Patches
Plain Diff
feat: apollo cache for events
parent
aee83bbf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/api/graphql/client.ts
+8
-1
8 additions, 1 deletion
packages/api/graphql/client.ts
with
8 additions
and
1 deletion
packages/api/graphql/client.ts
+
8
−
1
View file @
2c80d3cc
...
@@ -8,7 +8,7 @@ import { holiApiUrl } from '@holi/api/config'
...
@@ -8,7 +8,7 @@ import { holiApiUrl } from '@holi/api/config'
import
{
isSSR
}
from
'
@holi/core/helpers/isSSR
'
import
{
isSSR
}
from
'
@holi/core/helpers/isSSR
'
import
authorizationHeaderLink
from
'
./authorizationHeaderLink
'
import
authorizationHeaderLink
from
'
./authorizationHeaderLink
'
import
{
alwaysReplacePolicy
,
pagedPolicy
}
from
'
./cachePolicies
'
import
{
alwaysReplacePolicy
,
keyArgsWithoutLimitAndOffset
,
pagedPolicy
}
from
'
./cachePolicies
'
import
createLocaleHeaderLink
from
'
./createLocaleHeaderLink
'
import
createLocaleHeaderLink
from
'
./createLocaleHeaderLink
'
import
errorLink
from
'
./errorLink
'
import
errorLink
from
'
./errorLink
'
...
@@ -88,6 +88,9 @@ const uploadCapableTerminatingLink: ApolloLink = createUploadLink({
...
@@ -88,6 +88,9 @@ const uploadCapableTerminatingLink: ApolloLink = createUploadLink({
export
const
createCache
=
()
=>
export
const
createCache
=
()
=>
new
InMemoryCache
({
new
InMemoryCache
({
typePolicies
:
{
typePolicies
:
{
AppEvents_Event
:
{
keyFields
:
[
'
id
'
],
},
User
:
{
User
:
{
fields
:
{
fields
:
{
interests
:
alwaysReplacePolicy
,
interests
:
alwaysReplacePolicy
,
...
@@ -140,6 +143,10 @@ export const createCache = () =>
...
@@ -140,6 +143,10 @@ export const createCache = () =>
fields
:
{
fields
:
{
// here, we can specify e.g. pagination behavior, depending on the
// here, we can specify e.g. pagination behavior, depending on the
// query, see https://www.apollographql.com/docs/react/pagination/overview
// query, see https://www.apollographql.com/docs/react/pagination/overview
appEvents_event
:
alwaysReplacePolicy
,
appEvents_events
:
pagedPolicy
((
args
:
Record
<
string
,
unknown
>
|
null
)
=>
{
return
keyArgsWithoutLimitAndOffset
(
args
)
}),
appointments
:
pagedPolicy
(),
appointments
:
pagedPolicy
(),
lastInsights
:
pagedPolicy
(),
lastInsights
:
pagedPolicy
(),
appDonations_projects
:
pagedPolicy
(),
appDonations_projects
:
pagedPolicy
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment