-
Notifications
You must be signed in to change notification settings - Fork 54
fix: sync #264
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: sync #264
Conversation
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 45 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. WalkthroughThe changes involve multiple updates across various files in a project, focusing on enhancing entity synchronization, adjusting TypeScript configurations, and refining function parameters. Key modifications include the introduction of new parameters in system call functions, updates to movement direction handling, and the restructuring of import paths for better modularity. Overall, these changes aim to streamline functionality and maintain alignment with the latest project architecture. Changes
Sequence Diagram(s)sequenceDiagram
participant A as Client
participant B as Server
participant C as Database
A->>B: Request to move
B->>C: Update entity position
C-->>B: Acknowledge position update
B-->>A: Confirm move success
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 (
|
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, codebase verification and nitpick comments (1)
examples/dojo/dojo-starter/manifests/dev/base/contracts/dojo_starter-actions-7a1c7102.toml (1)
2-3
: LGTM! But ensure contract compatibility.The code changes are approved. The updated
class_hash
andoriginal_class_hash
values indicate a change in the underlying contract. Please ensure that these contract changes are compatible with the rest of the system.Verify that the updated contract:
- Implements all the required interfaces.
- Handles all the expected events and actions.
- Does not introduce any breaking changes to the existing functionality.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
examples/dojo/dojo-starter/Scarb.lock
is excluded by!**/*.lock
Files selected for processing (11)
- examples/clients/react/react-app/src/App.tsx (1 hunks)
- examples/clients/react/react-app/src/dojo/setup.ts (3 hunks)
- examples/dojo/dojo-starter/.github/workflows/test.yaml (1 hunks)
- examples/dojo/dojo-starter/README.md (1 hunks)
- examples/dojo/dojo-starter/Scarb.toml (1 hunks)
- examples/dojo/dojo-starter/dojo_dev.toml (1 hunks)
- examples/dojo/dojo-starter/manifests/dev/base/contracts/dojo_starter-actions-7a1c7102.toml (1 hunks)
- examples/dojo/dojo-starter/manifests/dev/base/dojo-world.toml (1 hunks)
- examples/dojo/dojo-starter/manifests/dev/deployment/manifest.json (3 hunks)
- examples/dojo/dojo-starter/manifests/dev/deployment/manifest.toml (2 hunks)
- packages/state/src/recs/index.ts (2 hunks)
Files skipped from review due to trivial changes (3)
- examples/clients/react/react-app/src/App.tsx
- examples/dojo/dojo-starter/.github/workflows/test.yaml
- examples/dojo/dojo-starter/Scarb.toml
Additional comments not posted (16)
examples/dojo/dojo-starter/manifests/dev/base/dojo-world.toml (1)
2-3
: Hashes updated. Provide more context on the implications.The
class_hash
andoriginal_class_hash
values have been updated to the same new hash value, suggesting an update to the class definition or implementation.Since the other fields in the manifest remain unchanged, it seems that the core structure and functionality of the class are intact.
To better understand the implications of these hash changes, could you please provide more context on:
- What specific changes were made to the
dojo-world
class that led to the hash updates?- How do these changes affect the way the class is identified or interacted with in the broader application context?
This additional context will help ensure that the hash updates are appropriate and don't have any unintended consequences.
examples/dojo/dojo-starter/dojo_dev.toml (1)
23-23
: Verify the correctness and implications of updating theworld_address
.The change updates the
world_address
to a new hexadecimal string, which seems valid. Assuming this new address is correct and intended, the change looks good.However, please verify that:
- The new address is indeed the one you intended to use.
- Updating to this new address won't cause any unexpected issues or side effects in the application's interactions with the associated blockchain or network environment.
examples/dojo/dojo-starter/README.md (1)
44-44
: Verify the implications of the--world
parameter change.The
--world
parameter value has been updated to0x3b34889efbdf01f707d5d7421f112e8fb85a42fb6f2e5422c75ce3253148b0e
. This change suggests a shift in the target world configuration for the Torii service, which could have implications for its functionality or the data it processes.Please ensure that:
- The new world configuration is intended and has been thoroughly tested.
- The change does not introduce any unintended side effects or compatibility issues.
- The documentation and any relevant configuration files are updated to reflect this change.
Consider running the following script to verify the usage of the
--world
parameter across the codebase:This script searches for the
--world
parameter in configuration files (YAML, TOML, JSON), Markdown files, and plain text files. Review the results to ensure consistency and identify any potential issues.examples/clients/react/react-app/src/dojo/setup.ts (4)
10-10
: LGTM!The code changes are approved.
32-37
: LGTM!The code changes are approved.
40-45
: LGTM!The code changes are approved. The new functionality to sync entities is a good addition.
86-86
: LGTM!The code changes are approved.
examples/dojo/dojo-starter/manifests/dev/deployment/manifest.toml (4)
3-4
: LGTM!The changes to the
class_hash
andoriginal_class_hash
values in the[world]
section are approved. They align with the PR objectives of updating the contract deployment details.
6-7
: LGTM!The changes to the
address
andtransaction_hash
values in the[world]
section are approved. They align with the PR objectives of updating the contract deployment details.
26-28
: LGTM!The changes to the
address
,class_hash
, andoriginal_class_hash
values in the[[contracts]]
section are approved. They align with the PR objectives of updating the contract deployment details.
Line range hint
1-120
: File approved!The changes in the
examples/dojo/dojo-starter/manifests/dev/deployment/manifest.toml
file have been thoroughly reviewed and are approved. They align with the PR objectives of updating the contract deployment details.packages/state/src/recs/index.ts (1)
221-225
: LGTM!The code changes are approved. Moving the
await client.getEntities
call inside thewhile (continueFetching)
loop ensures that entities are fetched repeatedly until thecontinueFetching
condition becomes false. This change supports scenarios where multiple batches of entities need to be retrieved, such as pagination or continuous fetching.examples/dojo/dojo-starter/manifests/dev/deployment/manifest.json (4)
Line range hint
1-1255
: LGTM!The remaining code changes in the JSON manifest are approved.
1232-1233
: LGTM! But verify the correctness of the new deployment details.The code changes to the
address
andtransaction_hash
fields are approved. However, ensure that the new deployment details are correct and match the actual deployment of the world contract.Run the following script to verify the correctness:
Verification successful
Deployment details are consistent and correctly set.
The
address
andtransaction_hash
values are consistently used across multiple configuration files, includingmanifest.toml
,manifest.json
, anddojo_dev.toml
. This consistency suggests that the deployment details are correctly set for the intended deployment. No issues were found with these values.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new world contract deployment details. # Test: Retrieve the world contract deployment details. Expect: Matching `address` and `transaction_hash`. fd -e cairo -x grep -A 10 -e $'World::constructor'Length of output: 49
Script:
#!/bin/bash # Search for the specific address and transaction_hash in the codebase to find references or validation points. rg '0x3b34889efbdf01f707d5d7421f112e8fb85a42fb6f2e5422c75ce3253148b0e' -A 5 rg '0x4729b83525f0dddbfce0afd73e0b6a39303de51690efd756691356c21c30067' -A 5Length of output: 3191
1253-1255
: LGTM! But verify the correctness of the new contract deployment details.The code changes to the
address
,class_hash
, andoriginal_class_hash
fields are approved. However, ensure that the new deployment details are correct and match the actual deployment of the contract.Run the following script to verify the correctness:
Verification successful
Deployment details are verified and consistent.
The
address
andclass_hash
values in themanifest.json
file are consistent with other configuration files, confirming the correctness of the deployment details.
manifest.json
and related.toml
files contain the expectedaddress
andclass_hash
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new contract deployment details. # Test: Retrieve the contract deployment details. Expect: Matching `address` and `class_hash`. fd -e cairo -x grep -A 10 -e $'constructor'Length of output: 42
Script:
#!/bin/bash # Search for JSON files that might contain deployment details. fd -e json # Search for the specific address and class_hash in the JSON files to verify their correctness. rg '0x5e8df8a235031ba8e66e590a7289d27d7d54c026bcdbda62b791c0a69055225' -A 5 rg '0x7304354bfea03508e0a8beaca98c9580c852a0e350b74dcafb55192c62fa3f4' -A 5Length of output: 7749
4-5
: LGTM! But verify the impact of the world contract changes.The code changes to the
class_hash
andoriginal_class_hash
fields are approved. However, ensure that the changes to the world contract's implementation or version do not have any unintended side effects.Run the following script to verify the impact:
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/create-dojo/src/index.ts (2 hunks)
Additional comments not posted (2)
packages/create-dojo/src/index.ts (2)
49-49
: LGTM!The change to the template path reflects the updated project structure and is consistent with the AI-generated summary.
70-70
: LGTM!The simplification of the URL to the main documentation page streamlines user access to resources and is consistent with the AI-generated summary.
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: 8
Outside diff range, codebase verification and nitpick comments (10)
examples/clients/react/react-phaser-example/src/phaser/config/constants.ts (1)
Update References to Removed
Direction
EnumThe
Direction
enum has been removed, but there are still multiple references to it across the codebase. These references need to be updated to use the new directionality management system to ensure the code functions correctly. Please address the following locations:
examples/clients/react/react-threejs/src/utils.ts
examples/clients/vue/vue-app/src/utils/index.ts
examples/clients/react/react-pwa-app/src/utils/index.ts
examples/clients/react/react-app/src/utils/index.ts
examples/clients/react/react-phaser-example/src/dojo/utils/index.ts
examples/clients/vue/vue-app/src/App.vue
Analysis chain
Line range hint
1-44
: Verify the impact of removing theDirection
enum on the codebase.The
Direction
enum has been removed from this file. This change may impact any existing references to theDirection
enum throughout the code, necessitating updates wherever these constants were utilized.Run the following script to verify the impact of removing the
Direction
enum:If the script yields any results, update those references to use the new directionality management system.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of removing the `Direction` enum on the codebase. # Test 1: Search for references to the `Direction` enum in TypeScript files. # Expect: No occurrences of `Direction.Unknown`, `Direction.Up`, `Direction.Down`, `Direction.Left`, or `Direction.Right`. rg --type ts -w $'Direction.(Unknown|Up|Down|Left|Right)' # Test 2: Search for references to the `Direction` enum in JavaScript files. # Expect: No occurrences of `Direction.Unknown`, `Direction.Up`, `Direction.Down`, `Direction.Left`, or `Direction.Right`. rg --type js -w $'Direction.(Unknown|Up|Down|Left|Right)'Length of output: 2220
examples/clients/vue/vue-app/src/dojo/DojoContext.tsx (1)
11-83
: LGTM!The
DojoContext
andDojoProvider
component are correctly implemented.To improve the code readability, consider extracting the
useBurnerManager
hook call and its properties into a separate variable. For example:+const burnerManager = useBurnerManager({ + burnerManager, +}); + +const { + create, + list, + get, + select, + deselect, + remove, + clear, + account, + isDeploying, + count, + copyToClipboard, + applyFromClipboard, + checkIsDeployed, +} = burnerManager;examples/clients/react/react-pwa-app/src/dojo/setup.ts (2)
14-88
: Improve the error handling for the burner manager initialization.Instead of catching and logging the error, consider propagating the error to the caller of the
setup
function. This allows the caller to handle the error appropriately based on the specific use case.Apply this diff to improve the error handling:
- try { - await burnerManager.init(); - if (burnerManager.list().length === 0) { - await burnerManager.create(); - } - } catch (e) { - console.error(e); - } + await burnerManager.init(); + if (burnerManager.list().length === 0) { + await burnerManager.create(); + }
35-35
: Avoid usingany
type assertions.The
contractComponents
object is type asserted asany
when passed togetSyncEvents
andgetSyncEntities
functions. Type assertions, especiallyany
, should be avoided as they can introduce type safety issues.Consider properly typing the
contractComponents
object and updating thegetSyncEvents
andgetSyncEntities
functions to accept the correct type instead of using type assertions.Also applies to: 43-43
examples/clients/vue/vue-app/src/dojo/setup.ts (2)
64-71
: Improve error handling in the burner manager initialization.Consider adding more specific error handling and logging in the
catch
block when initializing the burner manager. This will help in identifying and debugging issues more effectively.try { await burnerManager.init(); if (burnerManager.list().length === 0) { await burnerManager.create(); } } catch (e) { - console.error(e); + console.error("Error initializing burner manager:", e); + // Additional error handling or fallback logic }
78-80
: Add error handling and validation to thepublish
function.The
publish
function in the returned object directly callstoriiClient.publishMessage
without any error handling or validation. Consider adding try-catch block and validating the input parameters to ensure robustness.publish: (typedData: string, signature: ArraySignatureType) => { + try { + // Validate typedData and signature + if (!typedData || !signature) { + throw new Error("Invalid input parameters"); + } toriiClient.publishMessage(typedData, signature); + } catch (e) { + console.error("Error publishing message:", e); + // Additional error handling or fallback logic + } },examples/clients/react/react-phaser-example/src/dojo/typescript/contracts.gen.ts (1)
1-1
: Reminder: Do not modify this file manually.The comment indicates that this file is generated by dojo-bindgen and should not be modified manually. Any manual changes will be overwritten when the file is regenerated.
examples/clients/vanilla/phaser/src/dojo/createSystemCalls.ts (2)
23-77
: Consider refactoring thespawn
function to improve readability and maintainability.The
spawn
function is well-structured and uses appropriate error handling, but there are a few areas that could be improved:
- Consider breaking the function down into smaller, more focused functions to improve readability and maintainability.
- Move the
movesId
andpositionId
variables into thetry
block to limit their scope, since they are only used within that block.- Remove the
Position
andMoves
overrides only in thefinally
block, as removing them in both thecatch
andfinally
blocks is redundant.Here's an example of how the function could be refactored:
const addMoveOverride = (entityId: Entity, movesId: string) => { Moves.addOverride(movesId, { entity: entityId, value: { player: BigInt(entityId), remaining: (getComponentValue(Moves, entityId)?.remaining || 0) + 100, }, }); }; const addPositionOverride = (entityId: Entity, positionId: string) => { Position.addOverride(positionId, { entity: entityId, value: { player: BigInt(entityId), vec: { x: 10 + (getComponentValue(Position, entityId)?.vec.x || 0), y: 10 + (getComponentValue(Position, entityId)?.vec.y || 0), }, }, }); }; const waitForIndexerUpdate = async (account: Account) => { await new Promise<void>((resolve) => { defineSystem( world, [Has(Moves), HasValue(Moves, { player: BigInt(account.address) })], () => { resolve(); } ); }); }; const spawn = async (account: Account) => { const entityId = getEntityIdFromKeys([BigInt(account.address)]) as Entity; try { const movesId = uuid(); const positionId = uuid(); addMoveOverride(entityId, movesId); addPositionOverride(entityId, positionId); await client.actions.spawn({ account }); await waitForIndexerUpdate(account); } catch (e) { console.log(e); } finally { Position.removeOverride(positionId); Moves.removeOverride(movesId); } };
79-103
: Consider making minor improvements to themove
function for consistency and better error handling.The
move
function is generally well-written, but there are a couple of minor improvements that could be made:
- Log the actual error message instead of just the error object for more specific error handling.
- Return the promise instead of waiting for it to resolve, for consistency with the
spawn
function.Here's an example of how the function could be updated:
const move = async (account: Account, direction: Direction) => { try { await client.actions.move({ account, direction }); // Return the promise instead of waiting for it to resolve return new Promise<void>((resolve) => { defineSystem( world, [Has(Moves), HasValue(Moves, { player: BigInt(account.address) })], () => { resolve(); } ); }); } catch (e) { // Log the actual error message console.error("Error in move function:", e.message); throw e; } };examples/clients/react/react-threejs/src/dojo/typescript/models.gen.ts (1)
39-39
: Use lowercase primitives for consistency.The file uses
String
,BigInt
,Number
, andBoolean
types in various places. For consistency, please use lowercase primitives instead:
- Use
string
instead ofString
- Use
bigint
instead ofBigInt
- Use
number
instead ofNumber
- Use
boolean
instead ofBoolean
Apply this diff to fix the primitive types:
- data: String[]; + data: string[]; - pending_word: BigInt; + pending_word: bigint; - pending_word_len: Number; + pending_word_len: number; - selector: BigInt; + selector: bigint; - player: BigInt; + player: bigint; - remaining: Number; + remaining: number; - can_move: Boolean; + can_move: boolean; - player: BigInt; + player: bigint; - directions: String[]; + directions: string[]; - player: BigInt; + player: bigint; - x: Number; + x: number; - y: Number; + y: number; - player: BigInt; + player: bigint;Also applies to: 40-40, 41-41, 51-51, 61-61, 62-62, 64-64, 75-75, 76-76, 85-85, 95-95, 96-96, 105-105
Tools
Biome
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (42)
- examples/clients/react/react-app/src/App.tsx (3 hunks)
- examples/clients/react/react-app/src/dojo/createSystemCalls.ts (3 hunks)
- examples/clients/react/react-phaser-example/src/dojo/createClientComponents.ts (1 hunks)
- examples/clients/react/react-phaser-example/src/dojo/createNetworkLayer.ts (1 hunks)
- examples/clients/react/react-phaser-example/src/dojo/createSystemCalls.ts (1 hunks)
- examples/clients/react/react-phaser-example/src/dojo/setup.ts (4 hunks)
- examples/clients/react/react-phaser-example/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/react/react-phaser-example/src/dojo/typescript/models.gen.ts (1 hunks)
- examples/clients/react/react-phaser-example/src/phaser/config/constants.ts (1 hunks)
- examples/clients/react/react-phaser-example/src/phaser/systems/controls.ts (2 hunks)
- examples/clients/react/react-pwa-app/src/App.tsx (2 hunks)
- examples/clients/react/react-pwa-app/src/dojo/DojoContext.tsx (1 hunks)
- examples/clients/react/react-pwa-app/src/dojo/createClientComponents.ts (1 hunks)
- examples/clients/react/react-pwa-app/src/dojo/createSystemCalls.ts (2 hunks)
- examples/clients/react/react-pwa-app/src/dojo/setup.ts (1 hunks)
- examples/clients/react/react-pwa-app/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/react/react-pwa-app/src/dojo/typescript/models.gen.ts (1 hunks)
- examples/clients/react/react-pwa-app/src/main.tsx (1 hunks)
- examples/clients/react/react-threejs/src/dojo/DojoContext.tsx (2 hunks)
- examples/clients/react/react-threejs/src/dojo/createClientComponents.ts (1 hunks)
- examples/clients/react/react-threejs/src/dojo/createSystemCalls.ts (2 hunks)
- examples/clients/react/react-threejs/src/dojo/setup.ts (4 hunks)
- examples/clients/react/react-threejs/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/react/react-threejs/src/dojo/typescript/models.gen.ts (1 hunks)
- examples/clients/react/react-threejs/src/gameComponents/Player.tsx (5 hunks)
- examples/clients/react/react-threejs/src/main.tsx (1 hunks)
- examples/clients/vanilla/phaser/src/dojo/DojoContext.tsx (1 hunks)
- examples/clients/vanilla/phaser/src/dojo/createClientComponents.ts (1 hunks)
- examples/clients/vanilla/phaser/src/dojo/createSystemCalls.ts (1 hunks)
- examples/clients/vanilla/phaser/src/dojo/setup.ts (2 hunks)
- examples/clients/vanilla/phaser/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/vanilla/phaser/src/dojo/typescript/models.gen.ts (1 hunks)
- examples/clients/vanilla/phaser/src/dojo/useDojo.tsx (1 hunks)
- examples/clients/vanilla/phaser/src/scenes/scene-main.ts (3 hunks)
- examples/clients/vue/vue-app/src/App.vue (2 hunks)
- examples/clients/vue/vue-app/src/dojo/DojoContext.tsx (1 hunks)
- examples/clients/vue/vue-app/src/dojo/createClientComponents.ts (1 hunks)
- examples/clients/vue/vue-app/src/dojo/createSystemCalls.ts (2 hunks)
- examples/clients/vue/vue-app/src/dojo/setup.ts (1 hunks)
- examples/clients/vue/vue-app/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/vue/vue-app/src/dojo/typescript/models.gen.ts (1 hunks)
- examples/clients/vue/vue-app/src/dojo/useDojo.tsx (1 hunks)
Files skipped from review due to trivial changes (7)
- examples/clients/react/react-phaser-example/src/dojo/createClientComponents.ts
- examples/clients/react/react-pwa-app/src/dojo/DojoContext.tsx
- examples/clients/react/react-pwa-app/src/dojo/createClientComponents.ts
- examples/clients/react/react-threejs/src/dojo/typescript/contracts.gen.ts
- examples/clients/vanilla/phaser/src/dojo/createClientComponents.ts
- examples/clients/vue/vue-app/src/dojo/createClientComponents.ts
- examples/clients/vue/vue-app/src/dojo/typescript/contracts.gen.ts
Additional context used
Biome
examples/clients/react/react-phaser-example/src/dojo/typescript/models.gen.ts
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 40-40: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 41-41: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 51-51: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 61-61: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 62-62: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 64-64: Don't use 'Boolean' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'boolean' instead(lint/complexity/noBannedTypes)
[error] 75-75: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 76-76: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 85-85: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 95-95: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 96-96: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 105-105: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
examples/clients/react/react-pwa-app/src/dojo/typescript/models.gen.ts
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 40-40: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 41-41: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 51-51: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 61-61: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 62-62: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 64-64: Don't use 'Boolean' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'boolean' instead(lint/complexity/noBannedTypes)
[error] 75-75: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 76-76: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 85-85: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 95-95: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 96-96: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 105-105: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
examples/clients/react/react-threejs/src/dojo/typescript/models.gen.ts
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 40-40: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 41-41: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 51-51: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 61-61: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 62-62: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 64-64: Don't use 'Boolean' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'boolean' instead(lint/complexity/noBannedTypes)
[error] 75-75: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 76-76: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 85-85: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 95-95: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 96-96: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 105-105: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
examples/clients/vanilla/phaser/src/dojo/typescript/models.gen.ts
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 40-40: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 41-41: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 51-51: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 61-61: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 62-62: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 64-64: Don't use 'Boolean' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'boolean' instead(lint/complexity/noBannedTypes)
[error] 75-75: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 76-76: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 85-85: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 95-95: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 96-96: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 105-105: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
examples/clients/vue/vue-app/src/dojo/typescript/models.gen.ts
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 40-40: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 41-41: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 51-51: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 61-61: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 62-62: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 64-64: Don't use 'Boolean' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'boolean' instead(lint/complexity/noBannedTypes)
[error] 75-75: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 76-76: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 85-85: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 95-95: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 96-96: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
[error] 105-105: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
Additional comments not posted (95)
examples/clients/vanilla/phaser/src/dojo/useDojo.tsx (1)
4-15
: LGTM!The
useDojo
hook is implemented correctly:
- It uses the
useContext
hook to access theDojoContext
.- It throws an error if the
DojoContext
is not available, ensuring that the hook is used within aDojoProvider
.- It returns an object with
setup
andaccount
properties from the context, which is a good practice.The code changes are approved.
examples/clients/vue/vue-app/src/dojo/useDojo.tsx (2)
1-2
: LGTM!The imports are correctly used for the custom hook implementation.
4-15
: LGTM!The custom
useDojo
hook is correctly implemented:
- It uses the
useContext
hook to access theDojoContext
.- It throws an error if the context is not available, indicating that the hook must be used within a
DojoProvider
.- It returns an object with the necessary properties from the context.
examples/clients/react/react-threejs/src/dojo/createClientComponents.ts (1)
2-2
: LGTM!The import path change for
ContractComponents
is approved. It aligns with the AI-generated summary, suggesting a potential restructuring of the project's file organization or a shift towards a more type-safe or organized module structure.examples/clients/react/react-phaser-example/src/dojo/createNetworkLayer.ts (1)
6-6
: Verify the functionality of the newsetup
module.Ensure that the new
setup
module imported from./setup
provides the same functionality as the previous module imported from./generated/setup
.Run the following script to compare the two modules:
If the modules differ significantly, further investigation may be required to ensure the change does not introduce any breaking changes or unintended side effects.
examples/clients/react/react-pwa-app/src/main.tsx (1)
7-7
: LGTM! Verify the refactor.The change in the import path for the
setup
function looks good. It aligns with the PR objective of fixing a sync issue and updating the starter version.Please verify that the refactor from using an auto-generated setup module to a manually defined or differently structured setup module is complete and all the necessary changes have been made across the codebase.
You can use the following script to search for any remaining references to the old import path:
Verification successful
Refactor verified successfully.
The search for any remaining references to the old import path
./dojo/generated/setup.ts
returned no results, confirming that the refactor was completed correctly and no references to the old path remain in the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any remaining references to the old import path. # Test: Search for the old import path. Expect: No results. rg --type typescript $'./dojo/generated/setup.ts'Length of output: 83
Script:
#!/bin/bash # Description: Search for any remaining references to the old import path. # Test: Search for the old import path in .ts files. Expect: No results. rg './dojo/generated/setup.ts' --glob '*.ts'Length of output: 44
examples/clients/react/react-threejs/src/main.tsx (1)
7-7
: Verify the correctness of the new import path and ensure proper usage of thesetup
function.The import path for the
setup
function has been changed from./dojo/generated/setup.ts
to./dojo/setup.ts
, indicating a refactoring of the project structure. This change may impact how thesetup
function is utilized within the application, potentially affecting initialization processes or configurations that rely on this function.To verify the correctness of the new import path and ensure proper usage of the
setup
function, run the following script:Verification successful
The import path and usage of the
setup
function are correct.The new import path
examples/clients/react/react-threejs/src/dojo/setup.ts
exists, confirming the file's correct placement. Additionally, thesetup
function is being used correctly with theawait
keyword in another part of the codebase, indicating proper asynchronous usage. No issues were found with the changes.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new import path and ensure proper usage of the `setup` function. # Test 1: Verify that the new import path exists. Expect: The file should exist. if [ -f "examples/clients/react/react-threejs/src/dojo/setup.ts" ]; then echo "Test 1 passed: The new import path exists." else echo "Test 1 failed: The new import path does not exist." fi # Test 2: Search for the usage of the `setup` function. Expect: The function should be used correctly. rg --type typescript -A 5 $'setup\(' | rg --type typescript $'await setup\(' if [ $? -eq 0 ]; then echo "Test 2 passed: The `setup` function is being used correctly with the `await` keyword." else echo "Test 2 failed: The `setup` function is not being used correctly with the `await` keyword." fiLength of output: 654
Script:
#!/bin/bash # Description: Verify the correctness of the new import path and ensure proper usage of the `setup` function. # Test 1: Verify that the new import path exists. Expect: The file should exist. if [ -f "examples/clients/react/react-threejs/src/dojo/setup.ts" ]; then echo "Test 1 passed: The new import path exists." else echo "Test 1 failed: The new import path does not exist." fi # Test 2: Search for the usage of the `setup` function. Expect: The function should be used correctly. rg --glob '*.ts' -A 5 'setup\(' | rg --glob '*.ts' 'await setup\(' if [ $? -eq 0 ]; then echo "Test 2 passed: The `setup` function is being used correctly with the `await` keyword." else echo "Test 2 failed: The `setup` function is not being used correctly with the `await` keyword." fiLength of output: 691
examples/clients/react/react-phaser-example/src/phaser/systems/controls.ts (8)
18-18
: LGTM!The code change is approved.
25-25
: LGTM!The code change is approved.
32-32
: LGTM!The code change is approved.
39-39
: LGTM!The code change is approved.
46-46
: LGTM!The code change is approved.
53-53
: LGTM!The code change is approved.
60-60
: LGTM!The code change is approved.
67-67
: LGTM!The code change is approved.
examples/clients/react/react-threejs/src/dojo/DojoContext.tsx (3)
3-4
: LGTM!The import statement changes align with the refactoring of the provider management.
24-37
: LGTM!The changes to the
DojoProvider
component simplify the account creation process and integrate better with the Dojo framework's provider system.
Line range hint
1-88
: LGTM!The changes in the file look good and align with the refactoring of the provider management.
examples/clients/vanilla/phaser/src/dojo/DojoContext.tsx (4)
1-4
: LGTM!The import statements are correctly written and include all the required dependencies for the file.
6-9
: LGTM!The
DojoContextType
interface is correctly defined and includes the necessary properties for the Dojo context.
13-83
: LGTM!The
DojoProvider
component is correctly implemented and provides the necessary context for the Dojo engine. It properly handles the setup and management of accounts using theuseBurnerManager
hook.
1-83
: File ApprovedThe
DojoContext.tsx
file is well-structured, follows best practices, and provides the necessary context and provider components for the Dojo engine. No further changes or improvements are required.examples/clients/vue/vue-app/src/dojo/DojoContext.tsx (1)
1-9
: LGTM!The imports and the
DojoContextType
interface are correctly defined.examples/clients/react/react-phaser-example/src/dojo/setup.ts (5)
1-10
: LGTM!The changes to the imports improve clarity and remove unused imports. The updated import path for
setupWorld
aligns with the project structure.
29-31
: LGTM!The creation of
dojoProvider
using theDojoProvider
constructor with the provided configuration arguments looks good.
32-45
: LGTM!The changes to event and entity synchronization using the
getSyncEvents
andgetSyncEntities
functions improve clarity and modularity. The emphasis on event synchronization enhances the setup process while preserving entity synchronization.
77-87
: LGTM!The adjustments to the
systemCalls
property by includingworld
as a parameter align with the setup process. The addition oftoriiClient
,eventSync
, andsync
properties to the returned object improves their accessibility for further use.
19-19
: Verify the impact of disabling the relay functionality.Setting
relayUrl
to an empty string potentially disables relay functionality. Ensure that this change is intended and does not break any existing functionality.Run the following script to verify the usage of
relayUrl
:Verification successful
Consistent setting of
relayUrl
to an empty string across examples.The
relayUrl
is set to an empty string in multiple client setup files, and there is a fallback mechanism in the core configuration file that defaults toLOCAL_RELAY
ifrelayUrl
is not provided. This suggests that the change is intentional and should not break functionality. Please ensure thatLOCAL_RELAY
is correctly configured as the default relay URL.
packages/core/src/config/index.ts
: Fallback mechanism forrelayUrl
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `relayUrl` in the codebase. # Test: Search for the usage of `relayUrl`. Expect: No unintended usages. rg --type typescript $'relayUrl'Length of output: 66
Script:
#!/bin/bash # Description: Verify the usage of `relayUrl` in TypeScript files. # Test: Search for the usage of `relayUrl` in all `.ts` files. rg 'relayUrl' --glob '*.ts'Length of output: 620
examples/clients/react/react-threejs/src/dojo/setup.ts (5)
1-10
: LGTM!The changes to the import statements are approved. Removing unused imports and adjusting import paths improves clarity and consistency.
19-19
: Verify the change to therelayUrl
parameter.The
relayUrl
parameter has been changed fromconfig.relayUrl
to an empty string. Please ensure that this change is intentional and will not cause any issues.
29-44
: LGTM!The changes to the synchronization logic are approved. Restructuring the logic to create the
dojoProvider
before the event and entity synchronization enhances the logical flow and improves clarity.
77-77
: Verify the change to thecreateSystemCalls
function call.The
createSystemCalls
function call has been modified to passworld
as an argument instead ofcontractComponents
. Please ensure that this change is correct and will not cause any issues.
82-87
: LGTM!The changes to the return object are approved. Including
dojoProvider
,toriiClient
,eventSync
,sync
, andworld
in the return object provides more comprehensive access to the various components and entities used in the setup process, enhancing functionality and usability.examples/clients/vanilla/phaser/src/dojo/setup.ts (7)
1-10
: LGTM!The changes to the import statements are appropriate. The new imports are used in the updated code, and the unused imports have been removed, which helps streamline the codebase.
47-62
: LGTM!The refactoring of the
burnerManager
creation to utilize thedojoProvider
for the RPC provider enhances the integration with the Dojo framework. This change is appropriate and aligns with the architecture of the Dojo framework.
75-85
: LGTM!The changes to the return object of the
setup
function reflect the new structure of the client components and the addition of theeventSync
functionality. These changes are consistent with the updates made throughout the function and enhance the functionality of the setup process.
14-14
: LGTM!The change in the parameter type of the
setup
function fromConfig
toDojoConfig
is consistent with the updates made within the function.
12-12
: LGTM!The removal of the unused
IDojo
type alias helps streamline the codebase.
12-12
: LGTM!The
SetupResult
type alias remaining unchanged ensures backward compatibility.
14-21
: Verify error handling at the caller level.The error handling for the creation of the
toriiClient
has been removed, which simplifies the code. However, it's important to ensure that error handling is done appropriately at the caller level.Run the following script to verify the error handling:
Verification successful
Error handling verified for
setup
function in some instances.The
setup
function's error handling is confirmed at the caller level inexamples/clients/vanilla/phaser/src/main.ts
using a.catch
block. However, ensure that all instances, especially in React applications, handle errors appropriately, possibly through React's error boundaries or other mechanisms.
examples/clients/vanilla/phaser/src/main.ts
: Error handling present with.catch
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify error handling for the `setup` function at the caller level. # Test: Search for the usage of the `setup` function. Expect: Error handling at the caller level. rg --type typescript -A 10 $'setup\('Length of output: 73
Script:
#!/bin/bash # Description: Verify error handling for the `setup` function at the caller level. # Test: Search for the usage of the `setup` function. Expect: Error handling at the caller level. rg --type ts -A 10 $'setup\('Length of output: 10013
examples/clients/react/react-pwa-app/src/dojo/setup.ts (3)
1-11
: LGTM!The import statements are correctly written and follow a consistent naming convention. There are no unused imports.
12-12
: LGTM!The
SetupResult
type definition is correctly written and improves the type safety of the code.
33-45
: Clarify the purpose of theundefined
argument ingetSyncEvents
.The
getSyncEvents
function is called withundefined
as the third argument. It's unclear what this argument represents and if it's required. Please provide clarification or remove the argument if it's not needed.examples/clients/vue/vue-app/src/dojo/setup.ts (1)
1-10
: LGTM!The imports are well-organized and cover the necessary dependencies for the setup function.
examples/clients/react/react-phaser-example/src/dojo/typescript/contracts.gen.ts (1)
16-31
: LGTM!The code changes are approved.
examples/clients/react/react-pwa-app/src/dojo/typescript/contracts.gen.ts (3)
10-86
: LGTM!The
setupWorld
function is implemented correctly and follows the expected structure. It sets up the contract interactions by defining an inneractions
function and returning it as a property of the exported object.
16-31
: LGTM!The
spawn
function is implemented correctly. It executes a contract call with the specified parameters and includes appropriate error handling and logging.
34-56
: LGTM!The
move
function is implemented correctly. It executes a contract call with the specified parameters, including the index of theDirection
type in the calldata. It also includes appropriate error handling and logging.examples/clients/vanilla/phaser/src/dojo/typescript/contracts.gen.ts (3)
1-3
: Do not modify this file manually.The comment indicates that this file is generated by dojo-bindgen and should not be manually modified. Any manual changes will be overwritten when the file is regenerated.
16-31
: LGTM!The code changes are approved.
34-56
: LGTM!The code changes are approved.
examples/clients/react/react-app/src/dojo/createSystemCalls.ts (2)
14-14
: LGTM!The code changes are approved.
83-83
: Simplification of themove
function looks good, but please verify the impact of the removed logic.The code changes that simplify the
move
function by removing the logic for updating position and moves state before executing the move action are approved.However, please verify the following:
- The removed logic for updating position and moves state is not required.
- The calling code handles the state updates correctly.
examples/clients/vue/vue-app/src/dojo/createSystemCalls.ts (4)
17-22
: LGTM!The changes to the function signature are approved. The additional
world
parameter and the reordering of parameters improve the function.
28-35
: LGTM!The change to dynamically update the
remaining
value based on the existing value is approved. This improves the logic and allows for dynamic updates.
38-48
: LGTM!The change to update the
vec
property by adding the current position values is approved. This improves the movement logic by considering the current position.
51-68
: LGTM!The changes to the error handling and synchronization logic in the
spawn
andmove
functions are approved. The removal of redundant override removal and the addition of waiting for the indexer to update the entity improve the code and keep the UI in sync with the actual state.Also applies to: 81-99
examples/clients/react/react-pwa-app/src/dojo/createSystemCalls.ts (6)
18-21
: LGTM!The changes to the
createSystemCalls
function signature are approved.
23-46
: LGTM!The changes to the
spawn
function are approved. The updated logic for theMoves
andPosition
components improves the game state management.
55-68
: LGTM!The changes to the
spawn
function's error handling are approved. Waiting for the indexer to synchronize the UI with the actual state improves the user experience.
79-79
: LGTM!The change to the
move
function signature is approved.
86-99
: LGTM!The changes to the
move
function's logic are approved. Waiting for the indexer to synchronize the UI with the actual state improves the user experience.
Line range hint
1-110
: File ApprovedThe changes in the
examples/clients/react/react-pwa-app/src/dojo/createSystemCalls.ts
file are approved. The modifications improve the game state management and user experience.examples/clients/react/react-threejs/src/dojo/createSystemCalls.ts (2)
23-68
: LGTM!The code changes in the
spawn
function are consistent with the provided summary and enhance the game mechanics. The changes include:
- Updating the function signature to use
Account
instead ofAccountInterface
.- Altering the logic for setting the
Moves
component to calculate theremaining
value dynamically.- Computing the
Position
component'svec
value based on the current position for incremental updates.
79-99
: LGTM!The code changes in the
move
function are consistent with the provided summary and improve the functionality and user experience. The changes include:
- Updating the function signature to use
Account
instead ofAccountInterface
.- Streamlining the logic for updating the
Moves
component by removing the need for temporary IDs for overrides.- Adjusting the handling of the transaction to wait for the indexer to update the entity, keeping the UI in sync with the actual game state.
examples/clients/react/react-phaser-example/src/dojo/createSystemCalls.ts (4)
1-14
: LGTM!The updated imports are necessary for the changes made in the file.
20-21
: LGTM!The updated function signature is consistent with the list of alterations provided and is necessary for the changes made in the file.
23-77
: LGTM!The changes in the
spawn
function are well-implemented and provide the following benefits:
- The change from
AccountInterface
toAccount
is consistent with the list of alterations provided.- The addition of overrides for
Moves
andPosition
components enhances the dynamic interaction of entities in the game.- The refined error handling improves resource management and prevents potential memory leaks.
Line range hint
79-103
: LGTM!The changes in the
move
function are well-implemented and provide the following benefits:
- The change from
AccountInterface
toAccount
is consistent with the list of alterations provided.- The promise-based system ensures that the UI remains in sync with the underlying data.
examples/clients/vue/vue-app/src/App.vue (2)
4-8
: LGTM!The changes to the import statements are approved. Importing
Direction
from./dojo/typescript/models.gen.ts
instead of./utils
improves the organization and clarity of the code.
37-37
: LGTM!The change to the
moveFun
function's parameter type is approved. Updating the type fromany
toDirection
enhances type safety and improves the overall robustness of the code.examples/clients/react/react-pwa-app/src/App.tsx (4)
122-123
: LGTM!The code changes are approved. The change from using direction constants to objects containing a
type
property enhances the clarity and potential extensibility of the direction handling in the application.
133-134
: LGTM!The code changes are approved. The change from using direction constants to objects containing a
type
property enhances the clarity and potential extensibility of the direction handling in the application.
147-147
: Verify the missing position check.Unlike the code segments for moving up and left, there is no condition checking the position of the account before calling the
move
function when moving down. This might allow the account to move beyond the bottom border of the world.Run the following script to verify if there are any checks for the bottom border of the world:
140-140
: Verify the missing position check.Unlike the code segments for moving up and left, there is no condition checking the position of the account before calling the
move
function when moving right. This might allow the account to move beyond the right border of the world.Run the following script to verify if there are any checks for the right border of the world:
examples/clients/vanilla/phaser/src/scenes/scene-main.ts (4)
3-4
: LGTM!The code changes are approved.
142-142
: See the previous comment for verifying the usage of themove
method across the codebase.Also applies to: 148-148, 154-154
136-136
: Verify the usage of themove
method across the codebase.The method call to
this.dojo.systemCalls.move
has been updated to replace theDirection
enum with an object representation. Ensure that all usages of themove
method are updated to match the new object representation.Run the following script to verify the usage:
Verification successful
Verification successful: The
move
method uses the new object representation.The
move
method has been consistently updated to use the new object representation with atype
property in thescene-main.ts
file. The directions "Up", "Down", "Left", and "Right" are all correctly represented. No instances of the oldDirection
enum were found.
examples/clients/vanilla/phaser/src/scenes/scene-main.ts
: Lines using the new object representation for movement directions.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all usages of the `move` method match the new object representation. # Test: Search for the method usage. Expect: Only occurrences of the new object representation. rg --type typescript -A 5 $'this.dojo.systemCalls.move\(.*\{.*type:.*\}.*\)'Length of output: 112
Script:
#!/bin/bash # Description: Verify all usages of the `move` method match the new object representation. # Test: Search for the method usage without specifying the file type. rg -A 5 $'this.dojo.systemCalls.move\(.*\{.*type:.*\}.*\)'Length of output: 2495
6-6
: Verify the usage of thedojo
property across the codebase.The type of the
dojo
property has been changed fromIDojo
toSetupResult
. Ensure that all usages of thedojo
property are updated to match the new type.Run the following script to verify the usage:
examples/clients/react/react-app/src/App.tsx (4)
154-155
: The previous comment for line range 143-144 also applies to this code segment.
161-161
: The previous comments for line ranges 143-144 and 154-155 also apply to this code segment.
168-168
: The previous comments for line ranges 143-144, 154-155, and 161-161 also apply to this code segment.
143-144
: Verify the impact of the change in the data structure passed to themove
function.Ensure that the
move
function and other parts of the codebase are updated to handle the new data structure{ type: "Up" }
instead of the enum valueDirection.Up
.Run the following script to verify the usage of the
move
function:Verification successful
The change to the
move
function's argument structure is consistently applied across the codebase.The
move
function is being called with the new data structure{ type: "Up" }
and similar objects for other directions in various files. This indicates that the codebase has been updated to handle this change correctly. No further action is required.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `move` function in the codebase. # Test: Search for the `move` function calls. Expect: The arguments to match the new data structure. rg --type typescript -A 5 $'move\('Length of output: 71
Script:
#!/bin/bash # Description: Verify the usage of the `move` function in the codebase. # Test: Search for the `move` function calls without specifying a file type. rg -A 5 $'move\('Length of output: 22363
examples/clients/react/react-pwa-app/src/dojo/typescript/models.gen.ts (2)
1-3
: Acknowledge the generated nature of the file.This file is generated by dojo-bindgen and should not be manually modified. Skipping further review comments.
39-41
: Ignore static analysis hints for uppercase types.The usage of
String
,BigInt
,Number
, andBoolean
types is flagged by static analysis, suggesting using lowercase primitives instead. However, since this file is generated by dojo-bindgen and is not meant to be manually modified, these hints can be safely ignored in this context. The consistency of the generated code should be maintained.Also applies to: 51-51, 61-61, 62-62, 64-64, 75-76, 85-85, 95-96, 105-105
Tools
Biome
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 40-40: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 41-41: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
examples/clients/react/react-threejs/src/gameComponents/Player.tsx (10)
10-10
: LGTM!The import statement change is approved.
21-21
: LGTM!The changes to the
hoveredTile
state declaration are approved. They improve type safety and clarity.
51-54
: LGTM!The changes to the
BlueCell
interface declaration are approved. They improve code clarity.
56-56
: LGTM!The change to the
blueCellsAroundPlayer
array declaration is approved. It improves type safety.
58-58
: LGTM!The change to the
direction
property is approved. It improves code clarity and consistency.
66-66
: LGTM!The change to the
direction
property is approved. It improves code clarity and consistency.
74-74
: LGTM!The change to the
direction
property is approved. It improves code clarity and consistency.
82-82
: LGTM!The change to the
direction
property is approved. It improves code clarity and consistency.
137-137
: LGTM!The change to the
setHoveredTile
call is approved. It aligns with the new initialization approach for thehoveredTile
state.
185-185
: LGTM!The change to the
setHoveredTile
call is approved. It aligns with the new initialization approach for thehoveredTile
state.
const contractComponents = defineContractComponents(world); | ||
|
||
// create client components | ||
const { models: clientModels } = models({ contractModels }); | ||
const clientComponents = createClientComponents({ contractComponents }); | ||
|
||
// fetch all existing entities from torii | ||
let sync = null; | ||
try { | ||
sync = await getSyncEntities( | ||
toriiClient, | ||
contractModels as any, | ||
[], | ||
1000 | ||
); | ||
} catch (e) { | ||
console.error("Failed to fetch sync:", e); | ||
throw e; | ||
} | ||
// create dojo provider | ||
const dojoProvider = new DojoProvider(config.manifest, config.rpcUrl); | ||
|
||
let client = null; | ||
try { | ||
client = await setupWorld( | ||
new DojoProvider(config.manifest, config.rpcUrl), | ||
config | ||
); | ||
} catch (e) { | ||
console.error("Failed to create client:", e); | ||
throw e; | ||
} | ||
// Sync all events | ||
const eventSync = getSyncEvents( | ||
toriiClient, | ||
contractComponents as any, | ||
undefined, | ||
[] | ||
); | ||
|
||
const rpcProvider = new RpcProvider({ | ||
nodeUrl: config.rpcUrl, | ||
}); | ||
// Sync all entities | ||
const sync = await getSyncEntities( | ||
toriiClient, | ||
contractComponents as any, | ||
[] | ||
); |
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.
LGTM with a minor suggestion!
The changes simplify the code and enhance the clarity of the component creation process. The altered logic for fetching existing entities streamlines the flow of the function.
Consider moving the entity sync logic to the end of the function for better readability:
- // Sync all entities
- const sync = await getSyncEntities(
- toriiClient,
- contractComponents as any,
- []
- );
// setup world
const client = await setupWorld(dojoProvider);
// create burner manager
const burnerManager = new BurnerManager({
masterAccount: new Account(
{
nodeUrl: config.rpcUrl,
},
config.masterAddress,
config.masterPrivateKey
),
accountClassHash: config.accountClassHash,
rpcProvider: dojoProvider.provider,
feeTokenAddress: config.feeTokenAddress,
});
try {
await burnerManager.init();
if (burnerManager.list().length === 0) {
await burnerManager.create();
}
} catch (e) {
console.error(e);
}
+ // Sync all entities
+ const sync = await getSyncEntities(
+ toriiClient,
+ contractComponents as any,
+ []
+ );
return {
client,
clientComponents,
contractComponents,
systemCalls: createSystemCalls({ client }, clientComponents, world),
publish: (typedData: string, signature: ArraySignatureType) => {
toriiClient.publishMessage(typedData, signature);
},
config,
dojoProvider,
account: burnerManager.account as Account,
toriiClient,
eventSync,
sync,
};
Committable suggestion was skipped due to low confidence.
"dojo_starter" | ||
); | ||
} catch (error) { | ||
console.error("Error executing spawn:", error); |
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.
Fix the error message.
The error message is incorrect and should be updated to reflect the move
function.
Apply this diff to fix the error message:
-console.error("Error executing spawn:", error);
+console.error("Error executing move:", error);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
console.error("Error executing spawn:", error); | |
console.error("Error executing move:", error); |
"dojo_starter" | ||
); | ||
} catch (error) { | ||
console.error("Error executing spawn:", error); |
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.
Fix the error message.
The error message is incorrect and should be updated to reflect the world
function.
Apply this diff to fix the error message:
-console.error("Error executing spawn:", error);
+console.error("Error executing world:", error);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
console.error("Error executing spawn:", error); | |
console.error("Error executing world:", error); |
const world = async (props: { account: Account }) => { | ||
try { | ||
return await provider.execute( | ||
props.account, | ||
{ | ||
contractName: contract_name, | ||
entrypoint: "world", | ||
calldata: [], | ||
}, | ||
"dojo_starter" | ||
); | ||
} catch (error) { | ||
console.error("Error executing spawn:", error); | ||
throw error; | ||
} | ||
}; |
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.
Fix the error message in the catch
block.
The error message in the catch
block of the world
function is incorrect. It should be updated to reflect the correct function name.
Apply this diff to fix the error message:
-console.error("Error executing spawn:", error);
+console.error("Error executing world:", error);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const world = async (props: { account: Account }) => { | |
try { | |
return await provider.execute( | |
props.account, | |
{ | |
contractName: contract_name, | |
entrypoint: "world", | |
calldata: [], | |
}, | |
"dojo_starter" | |
); | |
} catch (error) { | |
console.error("Error executing spawn:", error); | |
throw error; | |
} | |
}; | |
const world = async (props: { account: Account }) => { | |
try { | |
return await provider.execute( | |
props.account, | |
{ | |
contractName: contract_name, | |
entrypoint: "world", | |
calldata: [], | |
}, | |
"dojo_starter" | |
); | |
} catch (error) { | |
console.error("Error executing world:", error); | |
throw error; | |
} | |
}; |
const world = async (props: { account: Account }) => { | ||
try { | ||
return await provider.execute( | ||
props.account, | ||
{ | ||
contractName: contract_name, | ||
entrypoint: "world", | ||
calldata: [], | ||
}, | ||
"dojo_starter" | ||
); | ||
} catch (error) { | ||
console.error("Error executing spawn:", error); | ||
throw error; | ||
} | ||
}; |
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.
Fix the error message in the catch block.
The error message in the catch block is incorrect. It should be updated to reflect the correct function name.
Apply this diff to fix the error message:
-console.error("Error executing spawn:", error);
+console.error("Error executing world:", error);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const world = async (props: { account: Account }) => { | |
try { | |
return await provider.execute( | |
props.account, | |
{ | |
contractName: contract_name, | |
entrypoint: "world", | |
calldata: [], | |
}, | |
"dojo_starter" | |
); | |
} catch (error) { | |
console.error("Error executing spawn:", error); | |
throw error; | |
} | |
}; | |
const world = async (props: { account: Account }) => { | |
try { | |
return await provider.execute( | |
props.account, | |
{ | |
contractName: contract_name, | |
entrypoint: "world", | |
calldata: [], | |
}, | |
"dojo_starter" | |
); | |
} catch (error) { | |
console.error("Error executing world:", error); | |
throw error; | |
} | |
}; |
data: String[]; | ||
pending_word: BigInt; | ||
pending_word_len: Number; |
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.
Use lowercase primitives for consistency.
The static analysis tool flagged the usage of String
, BigInt
, Number
, and Boolean
types, suggesting using lowercase primitives for consistency.
Apply this diff to fix the issues:
- data: String[];
+ data: string[];
- pending_word: BigInt;
+ pending_word: bigint;
- pending_word_len: Number;
+ pending_word_len: number;
- selector: BigInt;
+ selector: bigint;
- player: BigInt;
+ player: bigint;
- remaining: Number;
+ remaining: number;
- can_move: Boolean;
+ can_move: boolean;
- player: BigInt;
+ player: bigint;
- directions: String[];
+ directions: string[];
- player: BigInt;
+ player: bigint;
- x: Number;
+ x: number;
- y: Number;
+ y: number;
- player: BigInt;
+ player: bigint;
Also applies to: 51-51, 61-62, 64-64, 75-76, 85-85, 95-96, 105-105
Tools
Biome
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 40-40: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 41-41: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
export interface ByteArray { | ||
data: String[]; | ||
pending_word: BigInt; | ||
pending_word_len: Number; | ||
} |
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.
Use lowercase primitives for consistency.
The static analysis tool has flagged the usage of String
, BigInt
, Number
, and Boolean
types in the interface definitions. For consistency, it is recommended to use lowercase primitives instead.
Apply this diff to fix the issues:
export interface ByteArray {
- data: String[];
+ data: string[];
- pending_word: BigInt;
+ pending_word: bigint;
- pending_word_len: Number;
+ pending_word_len: number;
}
export interface Moves {
- player: BigInt;
+ player: bigint;
- remaining: Number;
+ remaining: number;
- can_move: Boolean;
+ can_move: boolean;
}
export interface DirectionsAvailable {
- player: BigInt;
+ player: bigint;
- directions: String[];
+ directions: string[];
}
export interface Moved {
- player: BigInt;
+ player: bigint;
}
export interface Vec2 {
- x: Number;
+ x: number;
- y: Number;
+ y: number;
}
export interface Position {
- player: BigInt;
+ player: bigint;
vec: Vec2;
}
Also applies to: 60-65, 74-77, 84-87, 93-97, 103-107
Tools
Biome
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 40-40: Don't use 'BigInt' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'bigint' instead(lint/complexity/noBannedTypes)
[error] 41-41: Don't use 'Number' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'number' instead(lint/complexity/noBannedTypes)
|
||
// Type definition for `core::byte_array::ByteArray` struct | ||
export interface ByteArray { | ||
data: String[]; |
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.
Use lowercase primitives for consistency.
The static analysis tool has flagged the usage of String
, Number
, Boolean
, and BigInt
types at multiple places in the file. For consistency, it is recommended to use lowercase primitives instead.
Please replace the following types with their lowercase counterparts:
String
→string
Number
→number
Boolean
→boolean
BigInt
→bigint
Do you want me to make these changes and submit a pull request?
Also applies to: 40-40, 41-41, 51-51, 61-61, 62-62, 64-64, 75-75, 76-76, 85-85, 95-95, 96-96, 105-105
Tools
Biome
[error] 39-39: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
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, codebase verification and nitpick comments (2)
examples/clients/vanilla/phaser/src/dojo/setup.ts (2)
24-24
: Lack of Error Handling fordefineContractComponents
The function
defineContractComponents
is used in multiple files without any apparent error handling. This confirms the concern that error handling has been removed or is missing. It is important to ensure that potential errors are handled appropriately to prevent runtime issues.
- Consider adding error handling around the invocation of
defineContractComponents
to manage any potential exceptions or errors that may arise during its execution.Analysis chain
Verify the error handling for the creation of the contract components.
The error handling for the creation of the contract components has been removed. While this simplifies the code, it is important to ensure that any potential errors are still handled appropriately.
Please run the following script to verify the error handling:
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the error handling for the creation of the contract components. # Test: Search for error handling related to the contract components. Expect: Relevant error handling code. rg --type typescript -A 5 $'defineContractComponents'Length of output: 87
Script:
#!/bin/bash # Description: Verify the error handling for the creation of the contract components. # Test: Search for error handling related to the contract components. Expect: Relevant error handling code. rg --type ts -A 5 $'defineContractComponents'Length of output: 14501
16-21
: Potential Issue: Missing Error Handling fortoriiClient
CreationThe creation of the
toriiClient
inexamples/clients/vanilla/phaser/src/dojo/setup.ts
lacks error handling, which could lead to unhandled exceptions if the client creation fails. Consider adding appropriate error handling to ensure robustness.
- File:
examples/clients/vanilla/phaser/src/dojo/setup.ts
Analysis chain
Verify the error handling for the creation of the
toriiClient
.The error handling for the creation of the
toriiClient
has been simplified by removing the try-catch block. While this improves the readability of the code, it is important to ensure that any potential errors are still handled appropriately.Please run the following script to verify the error handling:
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the error handling for the creation of the `toriiClient`. # Test: Search for error handling related to the `toriiClient`. Expect: Relevant error handling code. rg --type typescript -A 5 $'toriiClient'Length of output: 74
Script:
#!/bin/bash # Description: Verify the error handling for the creation of the `toriiClient`. # Test: Search for error handling related to the `toriiClient`. Expect: Relevant error handling code. rg --type ts -A 5 $'toriiClient'Length of output: 17110
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (21)
- examples/clients/react/react-app/src/App.tsx (4 hunks)
- examples/clients/react/react-app/src/dojo/createSystemCalls.ts (4 hunks)
- examples/clients/react/react-app/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/react/react-app/tsconfig.json (1 hunks)
- examples/clients/react/react-pwa-app/src/App.tsx (3 hunks)
- examples/clients/react/react-pwa-app/src/dojo/createSystemCalls.ts (2 hunks)
- examples/clients/react/react-pwa-app/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/react/react-pwa-app/tsconfig.json (1 hunks)
- examples/clients/react/react-threejs/src/dojo/createSystemCalls.ts (2 hunks)
- examples/clients/react/react-threejs/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/react/react-threejs/src/gameComponents/Players.tsx (1 hunks)
- examples/clients/react/react-threejs/tsconfig.json (1 hunks)
- examples/clients/vanilla/phaser/src/dojo/createSystemCalls.ts (1 hunks)
- examples/clients/vanilla/phaser/src/dojo/setup.ts (2 hunks)
- examples/clients/vanilla/phaser/src/dojo/typescript/contracts.gen.ts (1 hunks)
- examples/clients/vanilla/phaser/src/scenes/scene-main.ts (4 hunks)
- examples/clients/vue/vue-app/src/App.vue (4 hunks)
- examples/clients/vue/vue-app/src/dojo/createSystemCalls.ts (2 hunks)
- examples/clients/vue/vue-app/tsconfig.json (1 hunks)
- examples/clients/vue/vue-app/tsconfig.node.json (1 hunks)
- tsconfig.base.json (1 hunks)
Files skipped from review due to trivial changes (7)
- examples/clients/react/react-app/src/dojo/typescript/contracts.gen.ts
- examples/clients/react/react-app/tsconfig.json
- examples/clients/react/react-threejs/src/dojo/typescript/contracts.gen.ts
- examples/clients/react/react-threejs/src/gameComponents/Players.tsx
- examples/clients/react/react-threejs/tsconfig.json
- examples/clients/vue/vue-app/tsconfig.node.json
- tsconfig.base.json
Files skipped from review as they are similar to previous changes (10)
- examples/clients/react/react-app/src/App.tsx
- examples/clients/react/react-app/src/dojo/createSystemCalls.ts
- examples/clients/react/react-pwa-app/src/App.tsx
- examples/clients/react/react-pwa-app/src/dojo/createSystemCalls.ts
- examples/clients/react/react-pwa-app/src/dojo/typescript/contracts.gen.ts
- examples/clients/vanilla/phaser/src/dojo/createSystemCalls.ts
- examples/clients/vanilla/phaser/src/dojo/typescript/contracts.gen.ts
- examples/clients/vanilla/phaser/src/scenes/scene-main.ts
- examples/clients/vue/vue-app/src/App.vue
- examples/clients/vue/vue-app/src/dojo/createSystemCalls.ts
Additional comments not posted (12)
examples/clients/react/react-pwa-app/tsconfig.json (2)
2-2
: LGTM!Extending from a base TypeScript configuration file is a good practice for maintaining a consistent configuration across the project. It reduces duplication and makes it easier to manage the configuration.
4-4
: LGTM!Setting the
jsx
option to"react-jsx"
is correct for a React project using TypeScript.Verify that the removed compiler options are defined in the base configuration file
../../../../tsconfig.base.json
.Run the following script to verify the removed options:
Verification successful
Verification Successful
The removed compiler options from the
tsconfig.json
file in the React PWA app are correctly defined in thetsconfig.base.json
file at the root of the repository. This centralization ensures consistent configuration across the project.
- The following options are defined in
tsconfig.base.json
:target
,module
,lib
,skipLibCheck
,moduleResolution
,allowImportingTsExtensions
,resolveJsonModule
,isolatedModules
,noEmit
,strict
,noUnusedLocals
,noUnusedParameters
,noFallthroughCasesInSwitch
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the removed compiler options are defined in the base configuration file. # Test: Search for the removed options in the base configuration file. Expect: All removed options are found. rg --type json $'(target|lib|module|skipLibCheck|moduleResolution|allowImportingTsExtensions|resolveJsonModule|isolatedModules|noEmit|strict|noUnusedLocals|noUnusedParameters|noFallthroughCasesInSwitch|allowSyntheticDefaultImports)' ../../../../tsconfig.base.jsonLength of output: 335
Script:
#!/bin/bash # Search for any tsconfig.base.json files in the repository to verify its existence and correct path. fd tsconfig.base.jsonLength of output: 42
Script:
#!/bin/bash # Description: Verify the removed compiler options are defined in the base configuration file. # Test: Search for the removed options in the base configuration file. Expect: All removed options are found. rg --type json $'(target|lib|module|skipLibCheck|moduleResolution|allowImportingTsExtensions|resolveJsonModule|isolatedModules|noEmit|strict|noUnusedLocals|noUnusedParameters|noFallthroughCasesInSwitch|allowSyntheticDefaultImports)' tsconfig.base.jsonLength of output: 734
examples/clients/vue/vue-app/tsconfig.json (4)
9-9
: LGTM!Setting
esModuleInterop
totrue
is a recommended practice for better compatibility between CommonJS and ES modules. It enables cleaner import statements.
17-17
: LGTM!Setting
allowSyntheticDefaultImports
totrue
is beneficial for smoother interoperability with CommonJS modules. It allows default imports from modules with no default export.
18-18
: LGTM!Setting
baseUrl
to"."
is a good practice for cleaner module resolution. It establishes the base directory for resolving non-relative module names, allowing for shorter and cleaner import paths.
19-21
: LGTM!Configuring the
paths
option to map@/*
tosrc/*
is an excellent practice for improved code readability and maintainability. It allows using the@
prefix as an alias for thesrc
directory in import statements, providing a consistent and shorter syntax for importing modules.examples/clients/vanilla/phaser/src/dojo/setup.ts (4)
14-14
: LGTM!The changes to the
setup
function signature are approved. The update to acceptDojoConfig
instead ofConfig
aligns with the current architecture of the Dojo framework. The removal of theIDojo
type alias is also acceptable, as it is no longer needed.
41-45
: LGTM!The changes to the fetching of existing entities are approved. The new approach of directly calling
getSyncEntities
after definingcontractComponents
streamlines the code and improves its readability.
51-62
: LGTM!The changes to the creation of the
burnerManager
are approved. The refactoring to utilize thedojoProvider
for the RPC provider enhances the integration with the Dojo framework and improves the consistency of the code.
75-87
: LGTM!The changes to the return object of the
setup
function are approved. The inclusion ofclientComponents
instead ofclientModels
reflects the new structure of the client components, and the addition ofeventSync
provides new functionality for synchronizing events. These updates align the code with the current architecture and enhance its capabilities.examples/clients/react/react-threejs/src/dojo/createSystemCalls.ts (2)
Line range hint
23-78
: LGTM!The code changes in the
spawn
function are approved:
- The function signature has been updated to use
Account
instead ofAccountInterface
, which is consistent with the list of alterations.- The updated logic for setting the
Moves
andPosition
components seems reasonable and matches the AI-generated summary.- Waiting for the indexer to update the entity is a good practice to keep the UI in sync with the actual state.
79-103
: LGTM!The code changes in the
move
function are approved:
- The function signature has been updated to use
Account
instead ofAccountInterface
, which is consistent with the list of alterations.- Waiting for the indexer to update the entity is a good practice to keep the UI in sync with the actual state.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores