mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +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 => {
|
||||
return record.get('emotionsCount').low
|
||||
})
|
||||
|
||||
return emotionsCount
|
||||
},
|
||||
postsEmotionsCountByCurrentUser: async (object, params, context, resolveInfo) => {
|
||||
|
||||
@ -492,6 +492,36 @@ import Factory from './factories'
|
||||
to: 'p15',
|
||||
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({
|
||||
from: 'u2',
|
||||
to: 'p14',
|
||||
|
||||
@ -38,7 +38,7 @@ export default {
|
||||
currentUser: 'auth/user',
|
||||
}),
|
||||
},
|
||||
mounted() {
|
||||
created() {
|
||||
Object.keys(this.postsEmotionsCountByEmotion).map(emotion => {
|
||||
this.emotionsCount(emotion)
|
||||
})
|
||||
@ -66,6 +66,7 @@ export default {
|
||||
this.isActive(emotion)
|
||||
? this.postsEmotionsCountByEmotion[emotion]--
|
||||
: this.postsEmotionsCountByEmotion[emotion]++
|
||||
|
||||
const index = this.selectedEmotions.indexOf(emotion)
|
||||
if (index > -1) {
|
||||
this.selectedEmotions.splice(index, 1)
|
||||
@ -90,6 +91,7 @@ export default {
|
||||
}
|
||||
`,
|
||||
variables: { postId: this.post.id, data: { emotion } },
|
||||
fetchPolicy: 'no-cache',
|
||||
})
|
||||
.then(({ data: { postsEmotionsCountByEmotion } }) => {
|
||||
this.postsEmotionsCountByEmotion[emotion] = postsEmotionsCountByEmotion
|
||||
|
||||
@ -64,6 +64,12 @@ export default () => {
|
||||
mutation($from: _UserInput!, $to: _PostInput!, $data: _EMOTEDInput!) {
|
||||
AddPostEmotions(from: $from, to: $to, data: $data) {
|
||||
emotion
|
||||
from {
|
||||
id
|
||||
}
|
||||
to {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
|
||||
@ -221,8 +221,5 @@ export default {
|
||||
.shout-button {
|
||||
float: left;
|
||||
}
|
||||
// .emotions-buttons-mobile {
|
||||
// margin-top: -80px;
|
||||
// }
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user