-
Notifications
You must be signed in to change notification settings - Fork 49
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
fix bank pos #2474
fix bank pos #2474
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
WalkthroughThe changes in this pull request focus on the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
You are out of MentatBot reviews. Your usage will refresh December 16 at 08:00 AM. |
Failed to generate code suggestions for PR |
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
🧹 Outside diff range and nitpick comments (1)
client/src/ui/layouts/World.tsx (1)
135-139
: LGTM! Consider improving error handling.The multi-line formatting improves readability. However, consider enhancing the error handling for the subsequent async operations.
Consider this pattern for more robust error handling:
const fetch = async () => { + const operations = [ + { + task: () => addToSubscription( + dojo.network.toriiClient, + dojo.network.contractComponents as any, + structureEntityId.toString(), + { x: position?.x || 0, y: position?.y || 0 }, + ), + name: 'structure subscription' + }, + { + task: () => addToSubscription( + dojo.network.toriiClient, + dojo.network.contractComponents as any, + ADMIN_BANK_ENTITY_ID.toString(), + ), + name: 'bank subscription' + } + ]; + try { - await addToSubscription( - dojo.network.toriiClient, - dojo.network.contractComponents as any, - structureEntityId.toString(), - { x: position?.x || 0, y: position?.y || 0 }, - ); - - await addToSubscription( - dojo.network.toriiClient, - dojo.network.contractComponents as any, - ADMIN_BANK_ENTITY_ID.toString(), - ); + await Promise.all(operations.map(async ({ task, name }) => { + try { + await task(); + } catch (error) { + console.error(`Failed to add ${name}:`, error); + throw error; + } + })); } catch (error) { - console.error("Fetch failed", error); + // Handle the error appropriately (e.g., show user feedback) } finally { setWorldLoading(false); }This approach:
- Runs subscriptions in parallel for better performance
- Provides detailed error reporting for each operation
- Maintains atomic success/failure for the entire operation
Summary by CodeRabbit
World
component by restructuring subscription state updates for clarity.