Skip to content
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

Enh/setup entity queries #2543

Merged
merged 6 commits into from
Dec 16, 2024
Merged

Enh/setup entity queries #2543

merged 6 commits into from
Dec 16, 2024

Conversation

ponderingdemocritus
Copy link
Contributor

@ponderingdemocritus ponderingdemocritus commented Dec 16, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new functions for managing building quantities and subscriptions.
    • Enhanced data fetching and rendering for hyperstructures and fragment mines.
  • Bug Fixes

    • Improved error handling and logging for fetching operations.
  • Documentation

    • Updated comments and logging for better traceability and performance monitoring.
  • Refactor

    • Streamlined entity fetching logic and performance measurement across various components.
  • Style

    • Adjusted rendering logic for better user interface interaction with structures.

Copy link

vercel bot commented Dec 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eternum ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 16, 2024 9:39pm
eternum-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 16, 2024 9:39pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
eternum-landing ⬜️ Ignored (Inspect) Visit Preview Dec 16, 2024 9:39pm

Copy link
Contributor

coderabbitai bot commented Dec 16, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request focuses on updating the Eternum client's dependencies and refactoring several core components. The changes primarily involve incrementing versions of @dojoengine packages from 1.0.3-alpha.2 to 1.0.4-alpha.3.1.0, and modifying key files like queries.ts, setup.ts, main.tsx, Worldmap.ts, and various UI components. The updates aim to improve entity synchronization, performance monitoring, and data fetching mechanisms across the client application.

Changes

File Change Summary
client/package.json Updated versions of all @dojoengine dependencies from 1.0.3-alpha.2 to 1.0.4-alpha.3.1.0
client/src/dojo/queries.ts Replaced getEntities with syncPosition, added syncBuildingQty and addToSubscriptionBuildingQty functions, updated addToSubscription and addMarketSubscription with performance logging
client/src/dojo/setup.ts Enhanced syncEntitiesDebounced and setup functions with new configuration clauses, expanded model fetching, and added performance measurement timestamps
client/src/main.tsx Added performance measurement for setup function call, unconditional loading screen rendering
client/src/three/scenes/Worldmap.ts Improved entity fetching logic, enhanced updateExploredHex and computeTileEntities methods with better chunk and tile management
client/src/ui/layouts/World.tsx Added new subscription management for building quantities, updated fetch logic
client/src/ui/modules/world-structures/WorldStructuresMenu.tsx Updated fetchHyperstructureData function, refined entity rendering and filtering logic

Suggested reviewers

  • aymericdelab

Possibly related PRs

Poem

🐰 Hop, hop, through code's domain,
Dependencies dance, a version refrain!
Queries sync, performance takes flight,
Eternum's client shines ever so bright!
A rabbit's update, precise and clean 🚀

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ccad004 and 0e6fa4b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • client/package.json (1 hunks)
  • client/src/dojo/queries.ts (4 hunks)
  • client/src/dojo/setup.ts (5 hunks)
  • client/src/main.tsx (1 hunks)
  • client/src/three/scenes/Worldmap.ts (2 hunks)
  • client/src/ui/layouts/World.tsx (5 hunks)
  • client/src/ui/modules/world-structures/WorldStructuresMenu.tsx (1 hunks)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ponderingdemocritus ponderingdemocritus merged commit 7e18f86 into next Dec 16, 2024
6 of 9 checks passed
@ponderingdemocritus ponderingdemocritus deleted the enh/setup-entity-queries branch December 16, 2024 21:39
Copy link

Failed to generate code suggestions for PR

Copy link
Contributor

@mentatbot mentatbot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good overall with nice performance optimizations and improved entity queries. The Dojo engine upgrade seems well integrated. A few suggestions:

  1. Consider adding a debug/development flag for performance logging to avoid unnecessary logging in production
  2. The commented code in World.tsx should either be removed or documented
  3. Consider using a proper logging utility that can be configured for different environments
  4. The performance measurements are a good addition but could benefit from error handling

No major issues found that would block merging.

Thanks for using MentatBot. Give comments a 👍 or 👎 to help me improve!

@@ -116,6 +117,12 @@ export const World = ({ backgroundImage }: { backgroundImage: string }) => {
[structures, subscriptions],
);

// const { getBuildings } = useBuildings();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing commented out code or documenting why it's kept for future reference

@@ -126,6 +133,13 @@
return;
}

// syncBuildingQty(dojo.network.toriiClient, dojo.network.contractComponents as any, structureEntityId.toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing commented out code or documenting why it's kept for future reference

@@ -151,14 +198,18 @@ export async function setup({ ...config }: DojoConfig) {
"s0_eternum-SwapEvent",
"s0_eternum-LiquidityEvent",
"s0_eternum-HyperstructureContribution",
"s0_eternum-MapExplored",
],
},
},
false,
false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider wrapping performance logging in a debug flag or environment variable to avoid logging in production

false,
);
Promise.all([promiseTiles, promisePositions]).then(([tiles, positions]) => {
console.log(tiles, positions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a logging utility that can be configured for different environments instead of direct console.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants