-
Notifications
You must be signed in to change notification settings - Fork 754
fix private game join link #1997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe join hash parsing in Client.handleHash changed to require “#join=” and extracts the lobbyId via substring, removing reliance on URLSearchParams for the join case. Other hash routes (#purchase-completed, #token-login) and control flow remain the same. No exported/public APIs changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Browser
participant Client as Client.Main.handleHash
participant Modal as JoinPrivateLobbyModal
User->>Browser: Open link with hash "#join=<id>"
Browser->>Client: onhashchange / initial load
Client->>Client: Parse hash (startsWith "#join=")
Client->>Client: lobbyId = decodedHash.substring(6)
alt Valid lobbyId
Client->>Modal: Open join modal with lobbyId
else Invalid lobbyId
Client->>Client: Ignore / no-op
end
note over Client,Modal: Other hashes (#purchase-completed, #token-login) unchanged
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
9fa4398 to
f330a18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/client/Main.ts (1)
479-485: Extend legacy parsing and add tests
- In JoinPrivateLobbyModal.ts’s extractLobbyIdFromUrl, handle
#join?lobby=<id>and strip any trailing query before validation.- Add unit tests for all three cases in Main.ts and JoinPrivateLobbyModal.ts:
#join=<id>#join=<id>?foo=bar#join?lobby=<id>
🧹 Nitpick comments (1)
src/client/Main.ts (1)
479-481: Avoid magic number; use the prefix lengthUse a named prefix to make the intent clear and prevent off-by-one if the prefix changes.
- const lobbyId = decodedHash.substring(6); // Remove "#join=" + const JOIN_PREFIX = "#join=" as const; + const lobbyId = decodedHash.slice(JOIN_PREFIX.length);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/client/Main.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-09T02:20:43.637Z
Learnt from: VariableVince
PR: openfrontio/OpenFrontIO#1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.
Applied to files:
src/client/Main.ts
Description:
Main.ts wasn't handling the join properly.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
evan