useSelect in block Edit always returns default store value

It turned out that allItems gets populated …eventually. So the code in the beginning of the block must be extended to respond when allItems is populated:

export default function Edit(props) {
const { attributes, setAttributes } = props;

const allItems = useSelect(select => select('REST-extra_table').readItems(LECTURERS_TABLE));
const [populated, setPopulated] = useState(false);

if (! populated && allItems.length !== 0) {
    // further code here
    setPopulated(true);
}

What I did is checking each time the block is rendered if allItems is populated, but saving this information in State, so code which I want to run after it is populated runs only once.