2
0
mirror of https://github.com/lowdefy/lowdefy.git synced 2025-03-13 14:56:54 +08:00

fix(actions-core): Updated ScrollTo action to include param error handling.

This commit is contained in:
Sandile 2022-02-11 10:51:40 +02:00
parent 27838bcf75
commit 25b656f115

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