@@ -30,6 +30,16 @@ export default function getApolloClient () {
3030
3131export const meAnonSats = { }
3232
33+ // preserve locally-bumped zap/boost/downzap counters against stale SSR writes on navigation.
34+ // cache.modify (used by modifyActCache/updateAncestors) bypasses merge, so local bumps write
35+ // through cleanly; merge only runs on writeQuery/query-result writes, which is where stale
36+ // ssrData would otherwise clobber a pending zap that hasn't been sent to the server yet.
37+ const maxMerge = ( existing , incoming ) => {
38+ if ( existing == null ) return incoming
39+ if ( incoming == null ) return existing
40+ return Math . max ( existing , incoming )
41+ }
42+
3343const retryLink = new RetryLink ( {
3444 delay : {
3545 initial : 300 ,
@@ -328,6 +338,17 @@ function getClient (uri) {
328338 } ,
329339 Item : {
330340 fields : {
341+ sats : { merge : maxMerge } ,
342+ credits : { merge : maxMerge } ,
343+ meSats : { merge : maxMerge } ,
344+ meCredits : { merge : maxMerge } ,
345+ meDontLikeSats : { merge : maxMerge } ,
346+ downSats : { merge : maxMerge } ,
347+ boost : { merge : maxMerge } ,
348+ commentSats : { merge : maxMerge } ,
349+ commentCredits : { merge : maxMerge } ,
350+ commentDownSats : { merge : maxMerge } ,
351+ commentBoost : { merge : maxMerge } ,
331352 comments : {
332353 keyArgs : [ 'sort' ] ,
333354 merge ( existing , incoming ) {
0 commit comments