Demo using Slices Network GraphQL Relay API to make a teal.fm client

only take recent plays from the subscription

Changed files
+12
src
+12
src/App.tsx
··· 89 89 const newPlay = store.getRootField("fmTealAlphaFeedPlayCreated"); 90 90 if (!newPlay) return; 91 91 92 + // Only add plays from the last 24 hours 93 + const playedTime = newPlay.getValue("playedTime") as string | null; 94 + if (!playedTime) return; 95 + 96 + const playDate = new Date(playedTime); 97 + const cutoff = new Date(Date.now() - 24 * 60 * 60 * 1000); 98 + 99 + if (playDate < cutoff) { 100 + // Play is too old, don't add it to the feed 101 + return; 102 + } 103 + 92 104 const root = store.getRoot(); 93 105 const connection = ConnectionHandler.getConnection( 94 106 root,