Gutenberg: Prevent links from being clickable in the block. Error: “Cannot destructure property ‘frameElement’ of ‘r’ as it is null.”

It seems that this helped:

$is_backend = defined('REST_REQUEST') && true === REST_REQUEST && 'edit' === filter_input(INPUT_GET, 'context', FILTER_SANITIZE_STRING);

 if ( $is_backend == true) {
        $url = "#void";
    } else {
        $url = get_permalink( $post_id );
    };

$link = '<a ' . $fontsizeattr . ' href="' . $url . '" target="_self">' . $game_title . '</a>';

return "<p>" . $link . "</p>";

#void worked for me.