mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Fix bug
- apollo query fetchPolicy set to no-cache so that it will refetch a post's emotions count on page transition
This commit is contained in:
parent
295b7e7769
commit
cb7217f5a7
@ -122,6 +122,7 @@ export default {
|
|||||||
const [emotionsCount] = transactionRes.records.map(record => {
|
const [emotionsCount] = transactionRes.records.map(record => {
|
||||||
return record.get('emotionsCount').low
|
return record.get('emotionsCount').low
|
||||||
})
|
})
|
||||||
|
|
||||||
return emotionsCount
|
return emotionsCount
|
||||||
},
|
},
|
||||||
postsEmotionsCountByCurrentUser: async (object, params, context, resolveInfo) => {
|
postsEmotionsCountByCurrentUser: async (object, params, context, resolveInfo) => {
|
||||||
|
|||||||
@ -492,6 +492,36 @@ import Factory from './factories'
|
|||||||
to: 'p15',
|
to: 'p15',
|
||||||
data: 'surprised',
|
data: 'surprised',
|
||||||
}),
|
}),
|
||||||
|
f.emote({
|
||||||
|
from: 'u2',
|
||||||
|
to: 'p15',
|
||||||
|
data: 'surprised',
|
||||||
|
}),
|
||||||
|
f.emote({
|
||||||
|
from: 'u3',
|
||||||
|
to: 'p15',
|
||||||
|
data: 'surprised',
|
||||||
|
}),
|
||||||
|
f.emote({
|
||||||
|
from: 'u4',
|
||||||
|
to: 'p15',
|
||||||
|
data: 'surprised',
|
||||||
|
}),
|
||||||
|
f.emote({
|
||||||
|
from: 'u5',
|
||||||
|
to: 'p15',
|
||||||
|
data: 'surprised',
|
||||||
|
}),
|
||||||
|
f.emote({
|
||||||
|
from: 'u6',
|
||||||
|
to: 'p15',
|
||||||
|
data: 'surprised',
|
||||||
|
}),
|
||||||
|
f.emote({
|
||||||
|
from: 'u7',
|
||||||
|
to: 'p15',
|
||||||
|
data: 'surprised',
|
||||||
|
}),
|
||||||
f.emote({
|
f.emote({
|
||||||
from: 'u2',
|
from: 'u2',
|
||||||
to: 'p14',
|
to: 'p14',
|
||||||
|
|||||||
@ -38,7 +38,7 @@ export default {
|
|||||||
currentUser: 'auth/user',
|
currentUser: 'auth/user',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
Object.keys(this.postsEmotionsCountByEmotion).map(emotion => {
|
Object.keys(this.postsEmotionsCountByEmotion).map(emotion => {
|
||||||
this.emotionsCount(emotion)
|
this.emotionsCount(emotion)
|
||||||
})
|
})
|
||||||
@ -66,6 +66,7 @@ export default {
|
|||||||
this.isActive(emotion)
|
this.isActive(emotion)
|
||||||
? this.postsEmotionsCountByEmotion[emotion]--
|
? this.postsEmotionsCountByEmotion[emotion]--
|
||||||
: this.postsEmotionsCountByEmotion[emotion]++
|
: this.postsEmotionsCountByEmotion[emotion]++
|
||||||
|
|
||||||
const index = this.selectedEmotions.indexOf(emotion)
|
const index = this.selectedEmotions.indexOf(emotion)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.selectedEmotions.splice(index, 1)
|
this.selectedEmotions.splice(index, 1)
|
||||||
@ -90,6 +91,7 @@ export default {
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
variables: { postId: this.post.id, data: { emotion } },
|
variables: { postId: this.post.id, data: { emotion } },
|
||||||
|
fetchPolicy: 'no-cache',
|
||||||
})
|
})
|
||||||
.then(({ data: { postsEmotionsCountByEmotion } }) => {
|
.then(({ data: { postsEmotionsCountByEmotion } }) => {
|
||||||
this.postsEmotionsCountByEmotion[emotion] = postsEmotionsCountByEmotion
|
this.postsEmotionsCountByEmotion[emotion] = postsEmotionsCountByEmotion
|
||||||
|
|||||||
@ -64,6 +64,12 @@ export default () => {
|
|||||||
mutation($from: _UserInput!, $to: _PostInput!, $data: _EMOTEDInput!) {
|
mutation($from: _UserInput!, $to: _PostInput!, $data: _EMOTEDInput!) {
|
||||||
AddPostEmotions(from: $from, to: $to, data: $data) {
|
AddPostEmotions(from: $from, to: $to, data: $data) {
|
||||||
emotion
|
emotion
|
||||||
|
from {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
|||||||
@ -221,8 +221,5 @@ export default {
|
|||||||
.shout-button {
|
.shout-button {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
// .emotions-buttons-mobile {
|
|
||||||
// margin-top: -80px;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user