File tree Expand file tree Collapse file tree 1 file changed +19
-11
lines changed
examples/react/react-app/src/dojo Expand file tree Collapse file tree 1 file changed +19
-11
lines changed Original file line number Diff line number Diff line change 1
1
import { AccountInterface } from "starknet" ;
2
2
import {
3
3
Entity ,
4
+ Has ,
5
+ HasValue ,
4
6
World ,
5
- defineComponentSystem ,
7
+ defineSystem ,
6
8
getComponentValue ,
7
9
} from "@dojoengine/recs" ;
8
10
import { uuid } from "@latticexyz/utils" ;
@@ -53,13 +55,16 @@ export function createSystemCalls(
53
55
// Wait for the indexer to update the entity
54
56
// By doing this we keep the optimistic UI in sync with the actual state
55
57
await new Promise < void > ( ( resolve ) => {
56
- defineComponentSystem ( world , Moves , ( update ) => {
57
- const { value } = update ;
58
-
59
- if ( value [ 0 ] ?. player === BigInt ( account . address ) ) {
58
+ defineSystem (
59
+ world ,
60
+ [
61
+ Has ( Moves ) ,
62
+ HasValue ( Moves , { player : BigInt ( account . address ) } ) ,
63
+ ] ,
64
+ ( ) => {
60
65
resolve ( ) ;
61
66
}
62
- } ) ;
67
+ ) ;
63
68
} ) ;
64
69
} catch ( e ) {
65
70
console . log ( e ) ;
@@ -109,13 +114,16 @@ export function createSystemCalls(
109
114
// Wait for the indexer to update the entity
110
115
// By doing this we keep the optimistic UI in sync with the actual state
111
116
await new Promise < void > ( ( resolve ) => {
112
- defineComponentSystem ( world , Moves , ( update ) => {
113
- const { value } = update ;
114
-
115
- if ( value [ 0 ] ?. player === BigInt ( account . address ) ) {
117
+ defineSystem (
118
+ world ,
119
+ [
120
+ Has ( Moves ) ,
121
+ HasValue ( Moves , { player : BigInt ( account . address ) } ) ,
122
+ ] ,
123
+ ( ) => {
116
124
resolve ( ) ;
117
125
}
118
- } ) ;
126
+ ) ;
119
127
} ) ;
120
128
} catch ( e ) {
121
129
console . log ( e ) ;
You can’t perform that action at this time.
0 commit comments