WAIT: Unable to edit page, canvas shows different content

I’m unable to edit page built with bricks. The elements show on the structure pane but the canvas just shows totally different content. I checked the known issues docs and i can confirm i don’t even have rocket loader enabled. I am able to edit other pages fine tho. Please watch video below

Hi Emmanuelson,
Thanks so much for your report!

Do you have a general page template that applies to the list-property page? If so, does the problem persist if you exclude the list-property page?

Please send temporary login credentials and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase.

Best regards,
timmse

Yes, i have a general page template that applies to all pages, i then added the snippet below to not use the page template if the page has been edited with bricks. This works fine but juts noticed it’s the one getting in my way in the builder.

add_filter( 'bricks/active_templates', 'set_my_active_templates', 10, 3 );
function set_my_active_templates( $active_templates, $post_id, $content_type ) {
  // Only run my logic on the frontend
  if ( ! bricks_is_frontend() ) {
    return $active_templates;
  }

  // Return if single post $content_type is not 'content'
  if ( $content_type !== 'content' ) {
    return $active_templates;
  }

  // Return: Current post type is not 'post'
  
  $post_type = get_post_type( $post_id );

  $allowed_post_types = [
    'page'
    ];

    if ( !in_array($post_type, $allowed_post_types) ) {
        return $active_templates;
    }

  // Check if the current post has Bricks data, return value is an array
  $bricks_data = \Bricks\Database::get_data( $post_id, 'content' );

  if ( count( $bricks_data ) > 0 ) {
    // Has Bricks data: Don't use any template, set the $active_templates['content'] to current post ID
    $active_templates['content'] = $post_id;
  }

  return $active_templates;
}