A decentralized music tracking and discovery platform built on AT Protocol 🎵
listenbrainz spotify atproto lastfm musicbrainz scrobbling

Spread nowPlayings into payload and cache

Make the client update now-playings by assigning a fresh array and
disable redundant invalidations. Adjust the websocket message shape so
the fields arrive at the top level for the client to consume.

Changed files
+6 -4
apps
web
src
pages
home
feed
ws
src
+5 -3
apps/web/src/pages/home/feed/Feed.tsx
··· 74 } 75 76 const message = JSON.parse(event.data); 77 - queryClient.setQueryData(["now-playings"], () => message.nowPlayings); 78 queryClient.setQueryData( 79 ["scrobblesChart"], 80 () => message.scrobblesChart, ··· 83 await queryClient.invalidateQueries({ 84 queryKey: ["infiniteFeed", feedUri], 85 }); 86 - await queryClient.invalidateQueries({ queryKey: ["now-playings"] }); 87 - await queryClient.invalidateQueries({ queryKey: ["scrobblesChart"] }); 88 }; 89 90 return () => {
··· 74 } 75 76 const message = JSON.parse(event.data); 77 + queryClient.setQueryData(["now-playings"], () => [ 78 + ...message.nowPlayings, 79 + ]); 80 queryClient.setQueryData( 81 ["scrobblesChart"], 82 () => message.scrobblesChart, ··· 85 await queryClient.invalidateQueries({ 86 queryKey: ["infiniteFeed", feedUri], 87 }); 88 + // await queryClient.invalidateQueries({ queryKey: ["now-playings"] }); 89 + // await queryClient.invalidateQueries({ queryKey: ["scrobblesChart"] }); 90 }; 91 92 return () => {
+1 -1
apps/ws/src/main.ts
··· 80 if (channels.has(collection) && socket.readyState === WebSocket.OPEN) { 81 socket.send( 82 JSON.stringify({ 83 - nowPlayings, 84 scrobbles, 85 scrobblesChart, 86 actorScrobbles,
··· 80 if (channels.has(collection) && socket.readyState === WebSocket.OPEN) { 81 socket.send( 82 JSON.stringify({ 83 + ...nowPlayings, 84 scrobbles, 85 scrobblesChart, 86 actorScrobbles,