From 5f723033ccd3116c55d1e6cd5ac5b58bfae7d09e Mon Sep 17 00:00:00 2001 From: Hugo Agbonon Date: Thu, 24 Mar 2016 20:29:17 +0100 Subject: [PATCH] Prevent a crash when working with symbols --- demo/src/js/DemoApp.jsx | 6 +++++- demo/src/js/reducers.js | 4 +++- package.json | 2 +- src/ActionPreview.jsx | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/demo/src/js/DemoApp.jsx b/demo/src/js/DemoApp.jsx index 6865fcb..842ea5e 100644 --- a/demo/src/js/DemoApp.jsx +++ b/demo/src/js/DemoApp.jsx @@ -109,6 +109,9 @@ class DemoApp extends React.Component { +
@@ -155,6 +158,7 @@ export default connect( type: 'HUGE_PAYLOAD', payload: Array.from({ length: 10000 }).map((_, i) => i) }), - addFunction: () => ({ type: 'ADD_FUNCTION' }) + addFunction: () => ({ type: 'ADD_FUNCTION' }), + addSymbol: () => ({ type: 'ADD_SYMBOL' }) } )(DemoApp); diff --git a/demo/src/js/reducers.js b/demo/src/js/reducers.js index e930896..5330200 100644 --- a/demo/src/js/reducers.js +++ b/demo/src/js/reducers.js @@ -90,5 +90,7 @@ export default combineReducers({ str => str + '!' ) : state, addFunction: (state=null, action) => action.type === 'ADD_FUNCTION' ? - { f: FUNC } : state + { f: FUNC } : state, + addSymbol: (state=null, action) => action.type === 'ADD_SYMBOL' ? + { s: Symbol('symbol') } : state }); diff --git a/package.json b/package.json index 82c4736..b7ab03a 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "babel-runtime": "^6.3.19", "dateformat": "^1.0.12", "immutable": "^3.7.6", - "javascript-stringify": "^1.0.2", + "javascript-stringify": "^1.1.0", "jsondiffpatch": "^0.1.41", "jss": "^3.3.0", "jss-nested": "^1.0.2", diff --git a/src/ActionPreview.jsx b/src/ActionPreview.jsx index 2a61691..ff1aca8 100644 --- a/src/ActionPreview.jsx +++ b/src/ActionPreview.jsx @@ -30,6 +30,8 @@ function getItemString(createTheme, type, data) { return 'fn'; } else if (typeof val === 'string') { return `"${val.substr(0, 10) + (val.length > 10 ? '…' : '')}"` + } else if (typeof val === 'symbol') { + return 'symbol' } else { return val; }