Giter Site home page Giter Site logo

Comments (7)

sorodrigo avatar sorodrigo commented on June 4, 2024 1

Could you provide some snapshots of your store to see what's going on?

from redux-offline.

sorodrigo avatar sorodrigo commented on June 4, 2024 1

@aadarsh13pathak please redact tokens and personal data before sharing stuff 😳

from redux-offline.

aadarsh13pathak avatar aadarsh13pathak commented on June 4, 2024
import { createStore, applyMiddleware, compose } from "redux";
import { persistStore, persistReducer } from "redux-persist";
import AsyncStorage from "@react-native-async-storage/async-storage";
import ReduxThunk from "redux-thunk";
import ReduxLogger from "redux-logger";
import hardSet from "redux-persist/lib/stateReconciler/hardSet";
import rootReducer from "@store/store";

//offline
import { createOffline } from "@redux-offline/redux-offline";
import offlineConfig from "@redux-offline/redux-offline/lib/defaults";

const {
  middleware: offlineMiddleware,
  enhanceReducer: offlineEnhanceReducer,
  enhanceStore: offlineEnhanceStore
} = createOffline({
  ...offlineConfig,
  persist: false
});

const persistConfig = {
  key: "root",
  storage: AsyncStorage,
  stateReconciler: hardSet,
  whitelist: ["user", "inbox", "app", "offline", "journal", "learning", "todayCount"]
};

// const store: Store<IAppState> = createStore(
//   offlineEnhancer.enhanceReducer(rootReducer),
//   initialState,
//   composeEnhancers(
//       offlineEnhancer.enhanceStore,
//       applyMiddleware(offlineEnhancer.middleware as any, epicMiddleware),
//   )
// );

const persistedReducer = persistReducer(persistConfig, offlineEnhanceReducer(rootReducer));

const isDevMode = Boolean(__DEV__);

const middleWares = isDevMode ? [offlineMiddleware, ReduxThunk, ReduxLogger] : [offlineMiddleware, ReduxThunk];
const store = createStore(persistedReducer, {}, compose(offlineEnhanceStore, applyMiddleware(...middleWares)));

const persistor = persistStore(store);

export default { store, persistor };

from redux-offline.

aadarsh13pathak avatar aadarsh13pathak commented on June 4, 2024

hey @sorodrigo when i am online but my app treat me as offline

  "offline": {
    "busy": false,
    "lastTransaction": 30,
    "netInfo": {
      "isConnectionExpensive": false,
      "reach": "wifi"
    },
    "online": true,
    "outbox": [
      
    ],
    "retryCount": 0,
    "retryScheduled": false
}

and thats why my data nor push into outbox and neitther pop ,i have to switch on and off my internet then it will work as offline
and it log this

"offline": {
    "busy": false,
    "lastTransaction": 34,
    "netInfo": {
      "isConnectionExpensive": undefined,
      "reach": "none"
    },
    "online": false,
    "outbox": [
      [
        Object
      ]
    ],
    "retryCount": 0,
    "retryScheduled": false
}

from redux-offline.

sorodrigo avatar sorodrigo commented on June 4, 2024

Hmm I'm sorry but it's very hard to tell with the info I have. Are you testing in a simulator? Could you verify this happens in a real device? Also could you send me the state of the outbox:

  • before and after you enable airplane mode
  • before and after you disabled airplane mode

from redux-offline.

aadarsh13pathak avatar aadarsh13pathak commented on June 4, 2024

@sorodrigo yes this happens in my real device

Before enable aeroplane mode

"offline": {
"busy": false,
"lastTransaction": 0,
"netInfo": {
"isConnectionExpensive": false,
"reach": "wifi"
},
"online": true,
"outbox": [

],
"retryCount": 0,
"retryScheduled": false

},

after enable aeroplane mode

"offline": {
"busy": false,
"lastTransaction": 0,
"netInfo": {
"isConnectionExpensive": false,
"reach": "wifi"
},
"online": true,
"outbox": [

],
"retryCount": 0,
"retryScheduled": false

},

after disable aeroplane mode

"offline": {
"busy": false,
"lastTransaction": 1,
"netInfo": {
"isConnectionExpensive": false,
"reach": "wifi"
},
"online": true,
"outbox": [

],
"retryCount": 0,
"retryScheduled": false

after enable and disable my phone internet and that time my app work fine

"offline": {
"busy": false,
"lastTransaction": 1,
"netInfo": {
"isConnectionExpensive": undefined,
"reach": "none"
},
"online": false,
"outbox": [

],
"retryCount": 0,

from redux-offline.

aadarsh13pathak avatar aadarsh13pathak commented on June 4, 2024

@sorodrigo could you tell me ,
is something wrong in my code or its just a library issue ?

from redux-offline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.