MHC03

Results 16 comments of MHC03

You can see the issue in following fiddle: https://jsfiddle.net/qmknga7r/2/

Unfortunately, the workaround seems to not satisfy our requirement for the implemented functionality. Therefore, I would like to ask, if this small issue is going to be tackled somewhen soon....

Problem seems to be here: https://github.com/pmndrs/zustand/blob/main/src/middleware/persist.ts#L38. Haven't analyzed the specifics, but `str` there seems to be an object already, so using str.toString() has done the trick for me for the...

Possible solution. Please check if this seems right for you: ```ts if (str === null || Object.keys(str).length === 0) { return null; } return JSON.parse(str); ```

For mocking the AsyncStorage I use the mock implementation of RN's AsyncStorage. After further investigation I found out, that `str instanceof Promise` in that case is `false`. My suggestion would...

Digged in further again and found out that somehow `AsyncStorageMock.getItem` is of type `Promise { }` and this does not comply with `instanceof Promise` (should be `Promise { _x: 0,...

@dai-shi Your fix solves the problem, but this makes all of this more complicated than I thought. The reason, why all of this works with `toThenable` is because it catches...

No, it works for me, but I think `toThenable` is not ideal for both implementations, because it has some unexpected behaviour, at least for tests. @swemail Your error message is...

I think this needs no additional docs. @swemail Where and how have you created the mock directory and file for asyncstorage? When I use the directory method for mocking, it...