Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prettier #261

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class_hash = "0x72c6666cfeebc41544f502cfe9c32ad7b91fce12881709420335794dfcb324a"
original_class_hash = "0x72c6666cfeebc41544f502cfe9c32ad7b91fce12881709420335794dfcb324a"
abi = "manifests/dev/base/abis/models/dojo_starter-DirectionsAvailable-77844f1f.json"
tag = "dojo_starter-DirectionsAvailable"
qualified_path = "dojo_starter::models::directions_available"
manifest_name = "dojo_starter-DirectionsAvailable-77844f1f"

[[members]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class_hash = "0x2e06be7cf406eb3161fedf460a47faca68855eb9dad7d505c1b1f1875192ccd"
original_class_hash = "0x2e06be7cf406eb3161fedf460a47faca68855eb9dad7d505c1b1f1875192ccd"
abi = "manifests/dev/base/abis/models/dojo_starter-Moved-504403e5.json"
tag = "dojo_starter-Moved"
qualified_path = "dojo_starter::systems::actions::actions::moved"
Copy link

Choose a reason for hiding this comment

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

Verify and potentially correct the qualified_path.

The qualified_path value "dojo_starter::systems::actions::actions::moved" appears to have a redundancy with "actions::actions". Please verify if this is intentional or a typo. Correcting this could prevent potential misconfigurations or errors in referencing the manifest.

manifest_name = "dojo_starter-Moved-504403e5"

[[members]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class_hash = "0x4eac0db062821cc05485ba088b0bb748de83e901116216da171744dfc5ec6fa"
original_class_hash = "0x4eac0db062821cc05485ba088b0bb748de83e901116216da171744dfc5ec6fa"
abi = "manifests/dev/base/abis/models/dojo_starter-Moves-2a29373f.json"
tag = "dojo_starter-Moves"
qualified_path = "dojo_starter::models::moves"
manifest_name = "dojo_starter-Moves-2a29373f"

[[members]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class_hash = "0x6531637b0bbd741f8823b127d8958ed10a483dd1f2d7654975c1d7d7cbdab65"
original_class_hash = "0x6531637b0bbd741f8823b127d8958ed10a483dd1f2d7654975c1d7d7cbdab65"
abi = "manifests/dev/base/abis/models/dojo_starter-Position-2ac8b4c1.json"
tag = "dojo_starter-Position"
qualified_path = "dojo_starter::models::position"
manifest_name = "dojo_starter-Position-2ac8b4c1"

[[members]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,7 @@
}
],
"tag": "dojo_starter-DirectionsAvailable",
"qualified_path": "dojo_starter::models::directions_available",
"manifest_name": "dojo_starter-DirectionsAvailable-77844f1f"
},
{
Expand Down Expand Up @@ -2431,6 +2432,7 @@
}
],
"tag": "dojo_starter-Moved",
"qualified_path": "dojo_starter::systems::actions::actions::moved",
"manifest_name": "dojo_starter-Moved-504403e5"
},
{
Expand Down Expand Up @@ -2915,6 +2917,7 @@
}
],
"tag": "dojo_starter-Moves",
"qualified_path": "dojo_starter::models::moves",
"manifest_name": "dojo_starter-Moves-2a29373f"
},
{
Expand Down Expand Up @@ -3355,6 +3358,7 @@
}
],
"tag": "dojo_starter-Position",
"qualified_path": "dojo_starter::models::position",
"manifest_name": "dojo_starter-Position-2ac8b4c1"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class_hash = "0x72c6666cfeebc41544f502cfe9c32ad7b91fce12881709420335794dfcb324a"
original_class_hash = "0x72c6666cfeebc41544f502cfe9c32ad7b91fce12881709420335794dfcb324a"
abi = "manifests/dev/deployment/abis/models/dojo_starter-DirectionsAvailable-77844f1f.json"
tag = "dojo_starter-DirectionsAvailable"
qualified_path = "dojo_starter::models::directions_available"
manifest_name = "dojo_starter-DirectionsAvailable-77844f1f"

[[models.members]]
Expand All @@ -66,6 +67,7 @@ class_hash = "0x2e06be7cf406eb3161fedf460a47faca68855eb9dad7d505c1b1f1875192ccd"
original_class_hash = "0x2e06be7cf406eb3161fedf460a47faca68855eb9dad7d505c1b1f1875192ccd"
abi = "manifests/dev/deployment/abis/models/dojo_starter-Moved-504403e5.json"
tag = "dojo_starter-Moved"
qualified_path = "dojo_starter::systems::actions::actions::moved"
manifest_name = "dojo_starter-Moved-504403e5"

[[models.members]]
Expand All @@ -84,6 +86,7 @@ class_hash = "0x4eac0db062821cc05485ba088b0bb748de83e901116216da171744dfc5ec6fa"
original_class_hash = "0x4eac0db062821cc05485ba088b0bb748de83e901116216da171744dfc5ec6fa"
abi = "manifests/dev/deployment/abis/models/dojo_starter-Moves-2a29373f.json"
tag = "dojo_starter-Moves"
qualified_path = "dojo_starter::models::moves"
manifest_name = "dojo_starter-Moves-2a29373f"

[[models.members]]
Expand Down Expand Up @@ -112,6 +115,7 @@ class_hash = "0x6531637b0bbd741f8823b127d8958ed10a483dd1f2d7654975c1d7d7cbdab65"
original_class_hash = "0x6531637b0bbd741f8823b127d8958ed10a483dd1f2d7654975c1d7d7cbdab65"
abi = "manifests/dev/deployment/abis/models/dojo_starter-Position-2ac8b4c1.json"
tag = "dojo_starter-Position"
qualified_path = "dojo_starter::models::position"
manifest_name = "dojo_starter-Position-2ac8b4c1"

[[models.members]]
Expand Down
7 changes: 6 additions & 1 deletion packages/state/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export function convertValues(schema: Schema, values: any) {

switch (schemaType) {
case RecsType.StringArray:
if (value.type === "array" && value.value[0].type === "enum") {
if (value.type === "array" && value.value.length === 0) {
acc[key] = [];
} else if (
value.type === "array" &&
value.value[0].type === "enum"
) {
Comment on lines +23 to +28
Copy link

Choose a reason for hiding this comment

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

Approved: Robustness improvement in handling empty arrays.

The modification to explicitly handle empty arrays before processing their elements is a significant improvement. This change enhances the robustness of the convertValues function by preventing potential errors from accessing elements in an empty array.

Suggestion for Improvement:
Consider adding a comment above the new check to explain why empty arrays are handled separately, which can aid future maintainability and understanding for other developers.

acc[key] = value.value.map(
(item: any) => item.value.option
);
Expand Down
Loading