Possible bug in the documentation

Under the documentation for the Builder web component, there is the following code example

element.addEventListener('load', event => { 
  var data = event.detail.data
  if (!data) { 
    // No matching content was found
    show404()
  } else {
    animateIn()
  }
})

When I implement this, however, and I want to show a “page not found” page, event.detail is coming back as null, and therefore event.detail.data will produce a console error.

@Canuckaholic

I set up a working example of this here: zealous-bird-87zgs1 - CodeSandbox

My guess is maybe the model or content you are trying to pull is unpublished, and so it is returning null? You should be able to fix this by adding event.detail?.data and we can update that in the documentation, but the code itself should work otherwise. Let me know if you are encountering other issues with this code, otherwise I will update the page now.