svelte-persistent-store icon indicating copy to clipboard operation
svelte-persistent-store copied to clipboard

what could cause this error: ReferenceError: AggregateError is not defined in svelte-persistent-stores library

Open shellking4 opened this issue 2 years ago • 2 comments

what could cause this error: ReferenceError: AggregateError is not defined in svelte-persistent-stores library. I get this error when running the an app on a mobile device. And the error comes from svelte-persistent-stores library

shellking4 avatar Jun 04 '23 16:06 shellking4

This error don't come from @macfja/svelte-persistent-store but from the serialization library @macfja/serializer

This library predefined a several standard class like AggregateError. It's weird that you have the error, the class seem to be well-supported

Do you have some spec about the device ? Do the app run in a browser or in Node ?


If you don't need the class serialization, you can switch to another serializer (Procedure explained here: https://github.com/MacFJA/svelte-persistent-store/blob/main/.docs/How-To/06-Change-Serialization.md).

Be careful, simpler serialization also mean less flexible and more care to add to the data. For example, JSON.stringify don't handle circular reference

MacFJA avatar Jun 04 '23 19:06 MacFJA

Thanks for your reply. Perhaps the error is related to the device. I ran the app on an Android phone, precisely an Infinix hot 10. I'll try the workaround you proposed.

shellking4 avatar Jun 05 '23 23:06 shellking4