Skip to content

fix: entity sync #252

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

Merged
merged 4 commits into from
Aug 13, 2024
Merged

fix: entity sync #252

merged 4 commits into from
Aug 13, 2024

Conversation

ponderingdemocritus
Copy link
Contributor

@ponderingdemocritus ponderingdemocritus commented Aug 13, 2024

  • bumps to latest version
  • fixes syncing

Summary by CodeRabbit

  • New Features

    • Updated the Dojo Engine to a newer alpha version for enhanced capabilities.
    • Improved handling of complex data structures in the conversion process.
  • Bug Fixes

    • Simplified the querying process for user account data, potentially improving performance and reliability.
    • Addressed management issues related to position and movement state handling.
  • Chores

    • Cleaned up code comments to enhance readability.
    • Updated subproject references to the latest versions.

Copy link

coderabbitai bot commented Aug 13, 2024

Warning

Rate limit exceeded

@ponderingdemocritus has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 34 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between bf1b654 and f047fe3.

Walkthrough

This update enhances the application through several key modifications, including an upgrade of the dojoup command version, adjustments to the ToriiClient type, and improved handling of structured data types. Notably, some functions related to state management have been commented out, which may impact functionality. Overall, these changes aim to streamline the codebase while enhancing application performance and clarity.

Changes

File Path Change Summary
.github/workflows/ci.yaml Updated dojoup command version from v1.0.0-alpha.3 to v1.0.0-alpha.5.
examples/dojo-starter Changed commit reference for a subproject, updating from 7c01064... to beaf9a9....
examples/react/react-app/src/App.tsx Simplified useQuerySync hook call by changing its second argument to an empty array.
examples/react/react-app/src/dojo/createSystemCalls.ts Commented out functionality for managing position and movement overrides, affecting state handling.
examples/react/react-app/src/dojo/generated/setup.ts Removed commented-out sync variable for code cleanup.
packages/react/src/useQuerySync.ts Changed toriiClient parameter type from Client to ToriiClient.
packages/state/src/recs/index.ts Updated client parameter to ToriiClient in several async functions and modified logic in syncEntities.
packages/state/src/utils/index.ts Enhanced convertValues function to handle "struct" types more effectively with updated logic.

Sequence Diagram(s)

sequenceDiagram
    participant A as User
    participant B as App
    participant C as State Manager
    participant D as ToriiClient

    A->>B: Initiate Query
    B->>D: Use ToriiClient for Data Retrieval
    D-->>B: Return Data
    B->>C: Update State with Data
    C-->>B: Confirm State Updated
    B-->>A: Display Updated Information
Loading

Poem

🐇 In the garden, changes bloom,
New versions bring away the gloom.
With data flowing, swift and bright,
The rabbit hops with pure delight!
Code so tidy, functions clear,
A joyful dance, the end is near! 🌸


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Copy link

@coderabbitai coderabbitai bot left a 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, codebase verification and nitpick comments (1)
packages/state/src/utils/index.ts (1)

21-24: Remove commented-out code.

The commented-out code for handling "struct" types is no longer necessary and should be removed to improve code readability.

-        // if (value.type === "struct") {
-        //     acc[key] = convertValues(schemaType, value.value);
-        //     return acc;
-        // }
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5f81899 and 4352c67.

Files selected for processing (8)
  • .github/workflows/ci.yaml (1 hunks)
  • examples/dojo-starter (1 hunks)
  • examples/react/react-app/src/App.tsx (1 hunks)
  • examples/react/react-app/src/dojo/createSystemCalls.ts (2 hunks)
  • examples/react/react-app/src/dojo/generated/setup.ts (1 hunks)
  • packages/react/src/useQuerySync.ts (2 hunks)
  • packages/state/src/recs/index.ts (7 hunks)
  • packages/state/src/utils/index.ts (2 hunks)
Files skipped from review due to trivial changes (3)
  • .github/workflows/ci.yaml
  • examples/dojo-starter
  • examples/react/react-app/src/dojo/generated/setup.ts
Additional comments not posted (10)
packages/react/src/useQuerySync.ts (2)

31-33: LGTM!

The change to use ToriiClient in the useQuerySync function is appropriate given the context provided.


4-4: Ensure compatibility with ToriiClient.

The import statement has been updated to use ToriiClient, which suggests a more specific client is now required. Verify that all instances of useQuerySync in the codebase are compatible with this change.

packages/state/src/utils/index.ts (1)

71-78: LGTM! Verify the new struct handling logic.

The new handling logic for "struct" types in the convertValues function seems well-implemented. Ensure that this logic is thoroughly tested for various edge cases.

examples/react/react-app/src/dojo/createSystemCalls.ts (2)

85-106: Verify the impact of commenting out overrides.

The logic for position and movement overrides has been commented out. Verify if this is a temporary change and assess the impact on state management.


130-134: Consider the implications of removing cleanup logic.

The cleanup logic in the catch and finally blocks has been commented out. Ensure that this does not lead to untracked changes in the system's state.

examples/react/react-app/src/App.tsx (1)

20-20: Verify the impact of simplifying useQuerySync.

The change to use an empty array in useQuerySync might affect data synchronization. Ensure that this simplification does not break any existing functionality or assumptions about data fetching.

packages/state/src/recs/index.ts (4)

Line range hint 112-117:
Ensure compatibility with ToriiClient.

The change from Client to ToriiClient in getEntitiesQuery suggests a shift in client capabilities. Verify that all usages of this function are compatible with ToriiClient.

Verification successful

Compatibility with ToriiClient Verified

The ToriiClient is correctly imported and used in packages/state/src/recs/index.ts. The function getEntitiesQuery and others utilize ToriiClient consistently, ensuring compatibility. No issues were found regarding its usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify compatibility of `getEntitiesQuery` with `ToriiClient`.

# Test: Search for `getEntitiesQuery` usage. Expect: Ensure compatibility with `ToriiClient`.
rg --type ts $'getEntitiesQuery'

Length of output: 503


Script:

#!/bin/bash
# Check for the import and usage of `ToriiClient` in the file to ensure compatibility.
rg 'ToriiClient' packages/state/src/recs/index.ts -A 5

Length of output: 957


43-46: Ensure compatibility with ToriiClient.

The change from Client to ToriiClient in getSyncEntities suggests a shift in client capabilities. Verify that all usages of this function are compatible with ToriiClient.


166-173: Review new data handling in syncEntities.

The addition of a second parameter data in the callback for onEntityUpdated changes how entities are processed. Ensure that this new data structure is correctly handled and compatible with existing logic.


65-68: Ensure compatibility with ToriiClient.

The change from Client to ToriiClient in getEntities suggests a shift in client capabilities. Verify that all usages of this function are compatible with ToriiClient.

Copy link

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4352c67 and bf1b654.

Files selected for processing (1)
  • examples/dojo-starter (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • examples/dojo-starter

@ponderingdemocritus ponderingdemocritus changed the title Fix entity sync fix: entity sync Aug 13, 2024
@ponderingdemocritus ponderingdemocritus merged commit e342815 into main Aug 13, 2024
3 of 4 checks passed
@ponderingdemocritus ponderingdemocritus deleted the fix-entity-sync branch August 13, 2024 16:29
This was referenced Sep 18, 2024
This was referenced Oct 3, 2024
This was referenced Oct 12, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 21, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 31, 2024
This was referenced Nov 9, 2024
@coderabbitai coderabbitai bot mentioned this pull request Dec 3, 2024
5 tasks
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.

1 participant