null check added

path to confetti fixed after refactoring
This commit is contained in:
nurjinn jafar 2020-12-01 17:15:02 +01:00
parent 0e53e220d0
commit 1bf7ff8994

View file

@ -34,11 +34,11 @@ const EffectsOverlay: FunctionComponent<EffectsOverlayProps> = ({ roomWidth }) =
if (effect === null) {
const options = CHAT_EFFECTS.find((e) => e.command === name)?.options
try {
const { default: Effect }: { default: ICanvasEffectConstructable } = await import(`./${name}`);
const { default: Effect }: { default: ICanvasEffectConstructable } = await import(`../../../effects/${name}`);
effect = new Effect(options);
effectsRef.current[name] = effect;
} catch (err) {
console.warn('Unable to load effect module at \'./${name}\'.', err)
console.warn('Unable to load effect module at \'../../../effects/${name}\'.', err)
}
}
return effect;
@ -46,7 +46,9 @@ const EffectsOverlay: FunctionComponent<EffectsOverlayProps> = ({ roomWidth }) =
useEffect(() => {
const resize = () => {
if (canvasRef.current) {
canvasRef.current.height = window.innerHeight;
}
};
const onAction = (payload: { action: string }) => {
const actionPrefix = 'effects.';