Questions tagged [mobx-persist]

19 questions
5
votes
1 answer

Problem with rehydrating a tree structure in mobx-persist

I am having issues hydrating a store which contains a tree data structure consisting of TreeNode objects. I am using following library: https://github.com/pinqy520/mobx-persist The problem is that the instances get hydrated as objects instead of…
stoefln
  • 14,498
  • 18
  • 79
  • 138
5
votes
1 answer

undefined is not a function (evaluating 'decorator(target, property, desc)')

I want to integrate mobx and mobx-persist with react-navigation. I read these articles: [1] https://hackernoon.com/react-navigation-with-mobx-2064fcdaa25b [2]…
b24
  • 2,425
  • 6
  • 30
  • 51
4
votes
2 answers

How to rewrite this js class without decorators

I want to use mobx without using decorators. Usually I use decorate from mobx package but in this particular case, I could not find a way to make it work. Original code : import { observable } from 'mobx' import { create, persist } from…
Harijoe
  • 1,771
  • 1
  • 16
  • 27
4
votes
0 answers

How to use the rehydration with mobx-persist

I am new to mobx-persist. I am not able to figure out how rehydration works in mobx-persist. I tried asking about it in github but got no reply so far. I am wondering if anyone here is able to point me the right direction. The problem that I am…
Michael Sync
  • 4,834
  • 10
  • 40
  • 58
3
votes
1 answer

How to persist Mobx data on NextJS

Problem After user login user details are saved in mobx state. but after page refresh those data are gone. I want to persist data on mobx state so the user data are stay on mobx state until user logout. I tried mobx-persist-store but when I go to…
2
votes
0 answers

How to clone a Model in mobx?

I have a simple Model with observable id id class TodoStore { todos = []; id: generateId(); get completedTodosCount() { return this.todos.filter( todo => todo.completed === true ).length; } } const todoStore = new…
MMJ
  • 279
  • 7
  • 23
2
votes
1 answer

mobx-persist not persist my data in local storage

Recently i'm working with Mobx and works well but when refresh the page the data lost and is fine this but i want to retain data in localStorage. Mobx-persist is for save data in localStorage and i implemented it in my project but doesn't work and i…
2
votes
1 answer

React Native Mobx null pointer dereference

I'm using mobx (and mobx-persist) as my react native app global store (I'm using expo client). First I fetch some data from the server then i save the results in the store and persist them in asyncStorage. It was working fine at first but then…
2
votes
1 answer

react-native with mobx throw error

I implement react native with mobx and i get this errorr [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[Reaction@1] Error: [serializr] Failed to find default schema for undefined root…
Manspof
  • 598
  • 26
  • 81
  • 173
1
vote
0 answers

Can't persist MobX state tree in React Native

I am using MobX-state-tree for state management and mst-persist to persist my data. The problem is when I reload the app the initial data of the store renders first and then the persist data gets loaded. So whenever I want to check a persisted data…
1
vote
1 answer

How to persist store in ignite bowser

I am using ignite bowser boilerplate for my react native application. It uses mobx-state-tree for state management. Every time I restart my app it resets the store. Is there any way to persist store in ignite bowser ?
1
vote
1 answer

Use MobX with React Context while using Mobx Persist Store?

Originally, I was using new CounterStore inside React.createContext() context.ts import React from 'react' import { stores, PersistState, CounterStore } from '@/store/index' import type { ICounterStore } from '@/types/index' export const…
deadcoder0904
  • 7,232
  • 12
  • 66
  • 163
1
vote
0 answers

React Native: How to add mobx-persist to an existing store

I have something like this MobX store and would like to add state persistence to it using the library mobx-persist https://github.com/pinqy520/mobx-persist But I can't figure out how to do it right My store: import { observable, makeObservable,…
Alex Muha
  • 11
  • 3
1
vote
0 answers

Cannot get mobx persist to work without decorators. Simple example

I have a userStore class below. import {observable, action, decorate, when, computed} from 'mobx' import { requests, Scripts } from 'axios.js' import { create, persist } from 'mobx-persist' import userAltImage from 'images/user.png' const…
total-N00b
  • 45
  • 1
  • 5
1
vote
1 answer

Mobx-persist with encryption

I am using mobx-persist library to persist data and I need to implement encryption since I am dealing with sensitive data. I know that AsyncStorage does not support encryption so my idea is using Realm as storage. I am a beginner and I could not…
1
2