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 FlipperDevicePlugin = pluginMap.get(pluginName);
|
||||
if (persistingPlugin && persistingPlugin.getActiveNotifications) {
|
||||
store.dispatch(
|
||||
setActiveNotifications({
|
||||
notifications: persistingPlugin.getActiveNotifications(
|
||||
pluginStates[key],
|
||||
),
|
||||
client,
|
||||
pluginId: pluginName,
|
||||
}),
|
||||
);
|
||||
try {
|
||||
const notifications = persistingPlugin.getActiveNotifications(
|
||||
pluginStates[key],
|
||||
);
|
||||
store.dispatch(
|
||||
setActiveNotifications({
|
||||
notifications,
|
||||
client,
|
||||
pluginId: pluginName,
|
||||
}),
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(
|
||||
'Failed to compute notifications for plugin ' + pluginName,
|
||||
e,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user