Skip to content

Commit 96bfa7f

Browse files
author
puranban
committed
Add id in query and fix singleton for caching
1 parent 4099b0a commit 96bfa7f

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

community-dashboard/app/Base/configs/apollo.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ const link: ApolloLinkFromClient = ApolloLink.from([
3131

3232
const apolloOptions: ApolloClientOptions<NormalizedCacheObject> = {
3333
link,
34-
cache: new InMemoryCache(),
34+
cache: new InMemoryCache({
35+
typePolicies: {
36+
// NOTE: Singleton types that have no identifying field can use an empty
37+
// array for their keyFields.
38+
FilteredStats: {
39+
keyFields: [],
40+
},
41+
},
42+
}),
3543
assumeImmutableResults: true,
3644
defaultOptions: {
3745
query: {

community-dashboard/app/views/Dashboard/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ import {
1919
const COMMUNITY_STATS = gql`
2020
query CommunityStats {
2121
communityStatsLatest {
22+
id
2223
totalContributors
2324
totalUserGroups
2425
totalSwipes
2526
}
2627
communityStats {
28+
id
2729
totalContributors
2830
totalUserGroups
2931
totalSwipes

community-dashboard/app/views/UserDashboard/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,21 @@ import styles from './styles.css';
2626
const USER_STATS = gql`
2727
query UserStats($pk: ID!, $limit: Int!, $offset: Int!) {
2828
user(pk: $pk) {
29+
id
2930
userId
3031
username
3132
userInUserGroups(pagination: {limit: $limit, offset: $offset}) {
3233
count
3334
items {
35+
id
3436
userGroupId
3537
userGroupName
3638
membersCount
3739
}
3840
}
3941
}
4042
userStats(userId: $pk) {
43+
id
4144
stats {
4245
totalSwipes
4346
totalSwipeTime
@@ -54,7 +57,9 @@ const USER_STATS = gql`
5457
const FILTERED_USER_STATS = gql`
5558
query FilteredUserStats($pk: ID!, $fromDate: DateTime!, $toDate: DateTime!) {
5659
userStats(userId: $pk) {
60+
id
5761
filteredStats(dateRange: { fromDate: $fromDate, toDate: $toDate}) {
62+
id
5863
areaSwipedByProjectType {
5964
totalArea
6065
projectType

0 commit comments

Comments
 (0)