luke
CCConvex Community
•Created by luke on 6/25/2024 in #support-community
Weird bug with the new ConvexQueryCacheProvider and Nextjs Prod version
After I added the
ConvexQueryCacheProvider
to my Providers, every time I click on the "emojinx" logo, or on any of the buttons that redirect to the home page, it breaks the sync between Convex and NextJS app and nothing else loads.
The weird part is that if I navigate using the Browser's history (back button), then it works fine.
The app is live at https://emojinx.lucasfaria.dev/
If you check the console, you'll see that I'm logging both the debug from the cache and { games } on the main page and { game } on a game page.
Those objects are just what's being returned from the useQuery
.
Providers component: https://github.com/lucasheriques/emoji-match/blob/745f4b3af9900ea715f9a78914c890686e42d75a/app/providers.tsx
useGames
hook: https://github.com/lucasheriques/emoji-match/blob/1b9ecc81b8dbe8cb9d4598c0a3d0bfce5382b6d5/components/rooms/hooks/use-games.ts
RoomList
component, which runs on the index page: https://github.com/lucasheriques/emoji-match/blob/745f4b3af9900ea715f9a78914c890686e42d75a/components/rooms/rooms-list.tsx
The code is fully open source, in case you need more details. Feel free to ask.
Not sure what's happening here - it works fine locally with next dev
. The error also happens with next build && next start
so I don't think it's related to Vercel.4 replies
CCConvex Community
•Created by luke on 9/20/2023 in #show-and-tell
emojinx — emoji-themed multiplayer matching game
it's a fun and easy-to-set-up game to play with friends and co-workers! thank you Convex for such an incredible library that made the process of building this delightful and incredibly straightforward forward 🙂
live: http://emojinx.lucasfaria.dev/
code: https://github.com/lucasheriques/emojinx
demo: https://www.loom.com/share/e7dee280db8d4c1788312de7b4a24337?sid=b78564c0-08f7-4bf6-adf9-99008843e23f
5 replies
CCConvex Community
•Created by luke on 9/17/2023 in #support-community
How to optimize database bandwidth?
Hey everyone!
I'm working on a multiplayer emoji matching game, and while I've been having lots of friends help me test everything, I was surprised to see that I'm already very close to hitting the database bandwidth limit 😅
The project is fully open sourced, and you can check my Convex-generated schema right now here: https://github.com/lucasheriques/emojinx/blob/main/convex/schema.ts. You can also play the game here: http://emojinx.lucasfaria.dev/
I've started as naively as possible and just storing it in the best way to make it work and worry about performance later, but given that I'm already hitting some limits on Starter plan I'm wondering there's a couple of ways to do it better.
From what I researched in previous discussions here, database bandwidth is roughly measured by how many
db.calls
I'm making, which is a lot for a single multiplayer session. Here are the things I have to track multiple times during a game , and the related field on the schema:
- The status of each emoji (emojiList
)
- The players' score (players
)
- The current player turn (currentPlayerIndex
)
- currentMultiplayerTimer
(determines how many seconds the player has to make a play)
And the things I have to track only a couple of times per game:
- The status of the game (status
)
- The winners (winnerIds
)
- The room name (roomName
)
My first thought is to make different tables for the real-time-important stuff, and another one for these, but I would love to hear some of your thoughts as well.
Also, on a side note, I absolutely loved using Convex, and together with the hackathon from WebDevCody it single-handedly brought back my joy to side projects again. I already have my next idea too. My motivation is to build fun and interactive games to play together with my friends or coworkers remotely 😂 I always wanted to learn animations, but I was tired of just doing courses after courses, and this hackathon gave me the best opportunity to learn in practice11 replies