Skip to content

Commit f8f8c4e

Browse files
committed
Detect when we need to serialize (circular references) implicitly
Related to #26.
1 parent e0fa856 commit f8f8c4e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/browser/extension/inject/pageScript.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@ window.devToolsExtension = function(next) {
4242
state.filter = { whitelist, blacklist };
4343
}
4444

45-
window.postMessage({
46-
payload: typeof window.devToolsOptions.serialize === 'undefined' || window.devToolsOptions.serialize ? stringify(state) : state,
45+
const message = {
46+
payload: state,
4747
source: 'redux-page',
4848
init: init || false
49-
}, '*');
49+
};
50+
try {
51+
window.postMessage(message, '*');
52+
} catch (err) {
53+
message.payload = stringify(state);
54+
window.postMessage(message, '*');
55+
}
5056

5157
window.devToolsExtension.notifyErrors();
5258
}

src/browser/extension/options/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ chrome.runtime.getBackgroundPage( background => {
5151
<span className="caption">Actions to show (previous option will be ignored):</span>
5252
<textarea onChange={saveOption} id="whitelist" defaultValue={items.whitelist}/>
5353
</div>
54-
<div className="input">
55-
<span className="caption">States serialization:</span>
56-
<input id="serialize" type="checkbox" defaultChecked={items.serialize} onChange={saveOption}/>
57-
<span className="comment">(required for circular references)</span>
58-
</div>
5954
<div className="input">
6055
<span className="caption">Maximum delay:</span>
6156
<input id="timeout" type="text" defaultValue={items.timeout} onChange={saveOption}/>

src/browser/extension/options/syncOptions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const get = callback => {
1818
whitelist: '',
1919
blacklist: '',
2020
timeout: 1,
21-
serialize: true,
2221
notifyErrors: true,
2322
inject: true,
2423
urls: '^https?://localhost|0\\.0\\.0\\.0:\\d+\n^https?://.+\\.github\\.io'

0 commit comments

Comments
 (0)