chore(actions-core): Separated guard and if-else statement in ScrollTo action.

This commit is contained in:
Sandile 2022-02-11 16:18:20 +02:00
parent 4f838cf0a1
commit a03128fc26

View File

@ -19,7 +19,8 @@ import { type } from '@lowdefy/helpers';
function ScrollTo({ document, params, window }) {
if (!type.isObject(params)) {
throw new Error(`Invalid ScrollTo, check action params. Received "${JSON.stringify(params)}".`);
} else if (params.blockId) {
}
if (params.blockId) {
const element = document.getElementById(params.blockId);
if (element) {
element.scrollIntoView(params.options);