redux-electron-store icon indicating copy to clipboard operation
redux-electron-store copied to clipboard

SyntaxError: Unexpected token u in JSON at position 0

Open RossAddinall opened this issue 7 years ago • 0 comments

Sorry, this is going to be very brief.

I switched from 0.4.1 to 0.6.2 and got this error:

Uncaught SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at EventEmitter.eval (Y:\testdesigner_MVP\node_modules\redux-electron-store\lib\electronRendererEnhancer.js:178)
    at emitTwo (events.js:125)
    at EventEmitter.emit (events.js:213)

It is caused by action (_ref2.action) being undefined. I guess when the JSON parser parses this, it splits the string and we get a u at position 0.

It seems that the browser dispatch does this: webContents.send(${globalName}-browser-dispatch, JSON.stringify(action)); that is that all of the second argument is the stringified action

there is no action property to unpack with the statement:

var action = _ref2.action;
var sourceClientId = _ref2.sourceClientId;

However the src seems OK.

ipcRenderer.on(`${globalName}-browser-dispatch`, (event, stringifiedAction) => {
    context.flags.isUpdating = true;
    const action = JSON.parse(stringifiedAction);
    dispatcher(action);

Is it possible that this didn't build before you pushed it ?

Dropping back to 0.4.1 for now.

RossAddinall avatar Feb 07 '18 17:02 RossAddinall