Make sure notication computation can't crash the dispatch
Summary: Collecting notifications is done in the store.subscribe. If this throws however, the entire original dispatch throws (really Redux?!). So added a try catch around collecting notifications. This stops plugins from crashing while processing the queue (in fact this could happen during any Redux dispatch). Will look into a more robust mechanism in the future I suspect this also fixes the hanging graphQL issue Reviewed By: jknoxville Differential Revision: D20619226 fbshipit-source-id: 2f6b8e13a5c884dd63b6963d317474a2abf0725c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
79141f5fd2
commit
0a8d8f44ff
@@ -119,15 +119,23 @@ export default (store: Store, logger: Logger) => {
|
|||||||
| typeof FlipperPlugin
|
| typeof FlipperPlugin
|
||||||
| typeof FlipperDevicePlugin = pluginMap.get(pluginName);
|
| typeof FlipperDevicePlugin = pluginMap.get(pluginName);
|
||||||
if (persistingPlugin && persistingPlugin.getActiveNotifications) {
|
if (persistingPlugin && persistingPlugin.getActiveNotifications) {
|
||||||
store.dispatch(
|
try {
|
||||||
setActiveNotifications({
|
const notifications = persistingPlugin.getActiveNotifications(
|
||||||
notifications: persistingPlugin.getActiveNotifications(
|
pluginStates[key],
|
||||||
pluginStates[key],
|
);
|
||||||
),
|
store.dispatch(
|
||||||
client,
|
setActiveNotifications({
|
||||||
pluginId: pluginName,
|
notifications,
|
||||||
}),
|
client,
|
||||||
);
|
pluginId: pluginName,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(
|
||||||
|
'Failed to compute notifications for plugin ' + pluginName,
|
||||||
|
e,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user