Closed Tojteusz closed 3 years ago
Hi, I am looking for some solution on how to deal with this error Error: [mobx.array] Index out of bounds, KFZRSDF is larger than 0 I used this schema
Error: [mobx.array] Index out of bounds, KFZRSDF is larger than 0
directive @specifiedBy(url: String!) on SCALAR type Address { id: ID firstName: String lastName: String street: String houseNumber: String postcode: String city: String cityPart: String locationId: String } type Order { id: ID status: OrderStatus } type OrderStatus { colorCode: String text: String } type Query { orders: [Order] order(id: ID): Order addresses: [Address] address(id: ID): Address }
and perform this command npm run mst-gql --format ts --outDir app/models/ schema.graphql
npm run mst-gql --format ts --outDir app/models/ schema.graphql
and i wrote very similar queries in two different components
export const OrdersScreen: Component = observer(function OrdersScreen() { AsyncStorage.clear() const { store, loading, data, error } = useQuery(stores => stores.queryOrders({}, selectFromOrder() .status(status => status.text.colorCode) .toString(), ), ) console.log(" Loading: ", loading) console.log(" Error: ", error) if (data) console.log(" Data: ", data) ...
export const AccountScreen: Component = observer(function AccountScreen() { const { store, loading, data, error } = useQuery(stores => stores.queryAddresses( {}, selectFromAddress().firstName.lastName.street.toString(), ), ) console.log(" Loading: ", loading) console.log(" Error: ", error) if (data) console.log(" Data: ", data) ...
when I execute both queries I got the correct response from the server
{ "data": { "addresses": [ { "id": "a2P2o000001PbunEAC", "firstName": "Test", "lastName": "Tester", "street": "Adlerstr." }, { "id": "a2P2o000002IwXdEAK", "firstName": "Test", "lastName": "Tester", "street": "Adlerstr." } ] } }
{ "data": { "orders": [ { "id": "NFZ-4324234", "status": { "colorCode": "PENDING", "text": "order.status.inProgress" } }, { "id": "NFZ-3323514", "status": { "colorCode": "PENDING", "text": "order.status.inProgress" } }, { "id": "HW-23434", "status": { "colorCode": "PENDING", "text": "order.status.inProgress" } } ] } }
But consol.log for error from orders show Error: [mobx.array] Index out of bounds, NFZ-4324234 is larger than 0 and data is undefined but addresses work fine
Error: [mobx.array] Index out of bounds, NFZ-4324234 is larger than 0
data
undefined
Do you ever meet this case or do you know how to deal with it?
That was a mistake on our side. We change type of props in RootModel
Hi, I am looking for some solution on how to deal with this error
Error: [mobx.array] Index out of bounds, KFZRSDF is larger than 0
I used this schemaand perform this command
npm run mst-gql --format ts --outDir app/models/ schema.graphql
and i wrote very similar queries in two different components
when I execute both queries I got the correct response from the server
But consol.log for error from orders show
Error: [mobx.array] Index out of bounds, NFZ-4324234 is larger than 0
anddata
isundefined
but addresses work fineDo you ever meet this case or do you know how to deal with it?