-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache.ts
More file actions
188 lines (182 loc) · 4.86 KB
/
cache.ts
File metadata and controls
188 lines (182 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import type { InMemoryCacheConfig } from '@apollo/client/core';
import { ref } from 'vue';
import { config } from './config';
export const usernameVar = ref('');
export const setUsername = (username: string) => {
usernameVar.value = username;
};
export const profilePicURLVar = ref('');
export const setProfilePicURL = (url: string) => {
profilePicURLVar.value = url;
};
export const userDataLoadingVar = ref(false);
export const modProfileNameVar = ref('');
export const setModProfileName = (modProfileName: string) => {
modProfileNameVar.value = modProfileName;
};
export const isAuthenticatedVar = ref(false);
export const setIsAuthenticated = (status: boolean) => {
if (status === isAuthenticatedVar.value) {
return; // No change in authentication status, skip update
}
isAuthenticatedVar.value = status;
};
export const isLoadingAuthVar = ref(false);
export const setIsLoadingAuth = (status: boolean) => {
isLoadingAuthVar.value = status;
};
export const notificationCountVar = ref(0);
export const setNotificationCount = (count: number) => {
notificationCountVar.value = count;
};
export const sideNavIsOpenVar = ref(false);
export const setSideNavIsOpenVar = (status: boolean) => {
// Necessary to prevent a bug in which the event list
// event listeners interfere with navigation to the links
// in the side nav. This state is used to turn off the
// event listeners in the event list when the side nav is open.
sideNavIsOpenVar.value = status;
};
export const enteredDevelopmentEnvironmentVar = ref(
config.environment === 'development'
);
export const setEnteredDevelopmentEnvironment = (status: boolean) => {
enteredDevelopmentEnvironmentVar.value = status;
};
export const inMemoryCacheOptions: InMemoryCacheConfig = {
typePolicies: {
Tag: {
merge: true,
keyFields: ['text'],
},
ServerConfig: {
keyFields: ['serverName'],
},
ModerationProfile: {
keyFields: ['displayName'],
merge: true,
fields: {
ActivityFeed: {
merge: (_existing = [], incoming) => [...incoming],
},
AuthoredIssues: {
merge: (_existing = [], incoming) => [...incoming],
},
},
},
Channel: {
keyFields: ['uniqueName'],
merge: true,
fields: {
Tags: {
merge: (_existing = [], incoming) => [...incoming],
},
Admins: {
merge: (_existing = [], incoming) => [...incoming],
},
},
},
Discussion: {
keyFields: ['id'],
merge: true,
fields: {
Tags: {
merge: (_existing = [], incoming) => [...incoming],
},
DiscussionChannels: {
merge: (_existing = [], incoming) => [...incoming],
},
Author: {
merge: true,
},
Channel: {
merge: true,
},
},
},
Comment: {
keyFields: ['id'],
merge: true,
fields: {
CommentAuthor: {
merge: true,
},
UpvotedByUsers: {
merge: (_existing = [], incoming) => [...incoming],
},
FeedbackComments: {
merge: (_existing = [], incoming) => [...incoming],
},
},
},
CommentsAggregate: {
keyFields: false,
},
Event: {
keyFields: ['id'],
merge: true,
fields: {
Tags: {
merge: (_existing = [], incoming) => [...incoming],
},
EventChannels: {
merge: (_existing = [], incoming) => [...incoming],
},
Channels: {
merge: (_existing = [], incoming) => [...incoming],
},
Poster: {
merge: true,
},
},
},
DiscussionChannel: {
merge: true,
fields: {
UpvotedByUsers: {
merge: (_existing = [], incoming) => [...incoming],
},
Channel: {
merge: true,
},
Comments: {
merge: (_existing = [], incoming) => [...incoming],
},
},
},
User: {
keyFields: ['username'],
merge: true,
fields: {
Discussions: {
merge: (_existing = [], incoming) => [...incoming],
},
Comments: {
merge: (_existing = [], incoming) => [...incoming],
},
Events: {
merge: (_existing = [], incoming) => [...incoming],
},
UpvotedComments: {
merge: (_existing = [], incoming) => [...incoming],
},
UpvotedDiscussions: {
merge: (_existing = [], incoming) => [...incoming],
},
UpvotedEvents: {
merge: (_existing = [], incoming) => [...incoming],
},
ModProfiles: {
merge: (_existing = [], incoming) => [...incoming],
},
ChannelRoles: {
merge: (_existing = [], incoming) => [...incoming],
},
},
},
ChannelRole: {
merge: true,
},
Query: {},
},
};