Better handle no (valid) plugin selection
Summary: Little ux tweak, there are some rare scenarios where you can end up in an empty plugin screen, made a small message. Reviewed By: jknoxville Differential Revision: D22846396 fbshipit-source-id: 0ad19f1c252112d78a5587e6633fee2d9542d5e1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
685cc09b3b
commit
bce3d48e71
@@ -11,6 +11,7 @@ import React, {memo, useEffect, createElement} from 'react';
|
||||
import {SandyPluginContext} from './PluginContext';
|
||||
import {SandyPluginInstance} from './Plugin';
|
||||
import {SandyDevicePluginInstance} from './DevicePlugin';
|
||||
import {BasePluginInstance} from './PluginBase';
|
||||
|
||||
type Props = {
|
||||
plugin: SandyPluginInstance | SandyDevicePluginInstance;
|
||||
@@ -20,6 +21,9 @@ type Props = {
|
||||
* Component to render a Sandy plugin container
|
||||
*/
|
||||
export const SandyPluginRenderer = memo(({plugin}: Props) => {
|
||||
if (!plugin || !(plugin instanceof BasePluginInstance)) {
|
||||
throw new Error('Expected plugin, got ' + plugin);
|
||||
}
|
||||
useEffect(() => {
|
||||
plugin.activate();
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user