Easy way to convert id to String from Number? #3655
-
We want all our id's to be strings but some come in from the database as numbers. What's the easiest way to convert them on the way in? Can this be done with an Exchange? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There's a few options here, you can use a resolver in the normalized cache, you can use something like the community driven scalars exchange (seems unmaintained now but the idea's are still there) or you can write your own exchange that similar to the scalar exchange deeply traverses your graph and remaps the data: https://github.com/clentfort/urql-custom-scalars-exchange/blob/main/src/index.ts |
Beta Was this translation helpful? Give feedback.
There's a few options here, you can use a resolver in the normalized cache, you can use something like the community driven scalars exchange (seems unmaintained now but the idea's are still there) or you can write your own exchange that similar to the scalar exchange deeply traverses your graph and remaps the data: https://github.com/clentfort/urql-custom-scalars-exchange/blob/main/src/index.ts