Order of array with null keys
See original GitHub issueHi All
I have a query that returns an object witch contains an array. The items of the array have a predefined keys function that return null
For some of the objects the order of the array is not retained. (Actually it is reversed)
I have checked that the server returns the data in the correct order but the object returned from useQuery have them in the reverse order.
Find below the actual query. In the below query combinations in 2 of the 5 object returned are given in the reversed order. Also urql dev tools shows them in the correct order (When viewed inside explorer)
Any idea?
#import "./PurchasedScratchCardFragment.graphql"
#import "../../../graphql/AmountFragment.graphql"
query ScratchCards {
scratchCards {
id
name
background {
width
height
}
grid {
rows
columns
x
y
width
height
}
coverSmall {
width
height
}
coverLarge {
width
height
}
price {
...AmountFragment
}
mask {
x
y
}
maximumCombination {
win {
...AmountFragment
}
}
minimumCombination {
win {
...AmountFragment
}
}
combinations {
count
symbol
profitability
win {
...AmountFragment
}
}
symbolIndexes
purchases {
...PurchasedScratchCardFragment
}
}
}
And this is the relevant keys section
keys: {
ScratchCardMask: () => null,
ScratchCardCombination: () => null,
ScratchCardDimensions: () => null,
ScratchCardGrid: () => null,
Amount: () => null,
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How To Sort Empty key & value in lower order if its null in php
i Need when [comment]='' Field is Null Then it Should be sort & it would result in lower order. Array Structure [0] =>...
Read more >Sort an Array with NULL values coming last in JavaScript
To sort an array with NULL values coming last, call the `sort()` method on the array, passing it a function. The function defines...
Read more >Sorting an array objects by property having null value in ...
Our function should sort the array such that all the objects having keys mapped to null are pushed to the end of the...
Read more >Java 8 - How to sort List and Arrays with null values
We are going to sort list of Customer objects which contains null values according to their name in alphabetical order · Comparator. ·...
Read more >Order of array with null keys #835 - urql-graphql/urql - GitHub
The items of the array have a predefined keys function that return null For some of the objects the order of the array...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kitten you were right i was doing a sort somewhere having the impression that sort does not modify the original array.
Really sorry!
No worries! Glad we figured it out