Error Encountered with Retool Application's Transformer Evaluation

I'm encountering an issue with my Retool application where I'm getting the following errors: 'Could not evaluate transformer in XXXXX: Error: Cannot read properties of null (reading 'filter').' Whenever I reload the page or run the save query , I'm using the multi-select feature to query and display multiple options, but it seems to be causing this error. Any insights or solutions would be greatly appreciated!

const selectedClouds = {{ multiselectcloud }}?.selectedItems?.map(cloud => cloud).filter(cloud => cloud === 'gcp');
retool version I am using Retool version 3.24.9

This code assumes selectedItems has items selected. If the drop down has nothing selected, there is nothing to map. You might want to add a null check, something along the lines of

const selectedItems = {{ multiselectcloud }}?.selectedItems;
const selectedClouds = selectedItems ? selectedItems.map(cloud => cloud).filter(cloud => cloud === 'gcp') : [];