offlineExchange failing to save to IndexedDB due to variables proxy #1809
-
Hi all, thanks for the work you put into this awesome library. I've come across a weird bug when I'm offline and trying to execute a mutation. The offline exchange is sucessfully catching the operation and saving it to the failed queue. The problem comes when it tries to save the operation to the IndexedDB storage here. I get this error operation.variables is a Proxy wrapped object in @urql/vue. I read that proxies can't be saved into IDB. So I went into the code and wrapped the results with JSON.parse(JSON.strigify(results)) and it seems to have saved successfully. Let me know if I'm looking in the wrong spot, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I think that sounds like a correct approach, we could check if it's a proxy and execute EDIT: created a PR to resolve this issue #1810 |
Beta Was this translation helpful? Give feedback.
I think that sounds like a correct approach, we could check if it's a proxy and execute
JSON.parse(JSON.strigify(operation.variables))
however we could also opt to send it as a non-proxy like object into the urql-pipeline 😅 so patch it in@urql/vue
to be a POJOEDIT: created a PR to resolve this issue #1810