# Zoom Component View not setting default view as gallery, no errors. Opens in ribbon view

**URL:** <https://devforum.zoom.us/t/zoom-component-view-not-setting-default-view-as-gallery-no-errors-opens-in-ribbon-view/84157>\
**Category:** Web\
**Created:** [March 4, 2023, 7:44pm UTC](https://devforum.zoom.us/t/zoom-component-view-not-setting-default-view-as-gallery-no-errors-opens-in-ribbon-view/84157 "2023-03-04T19:44:47Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![linzblue5](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/linzblue5/32/45789_2.png) [@linzblue5](https://devforum.zoom.us/u/linzblue5)\
**Post date:** [March 7, 2023, 7:23am UTC](https://devforum.zoom.us/t/zoom-component-view-not-setting-default-view-as-gallery-no-errors-opens-in-ribbon-view/84157/3 "2023-03-07T07:23:25Z")

</div>

Awesome I appreciate you, yeah in the update I think a week ago the api is supposed to allow us to set the default view, but thank you I was able to get the following code to work based off the example you gave if anybody needs the “actual” (this is the solution), but the solution for the gallery view in particular I’ll include my code:

```auto
  client.on('connection-change', (e) => {
    if (e.state == 'Connected') {
      return new Promise((resolve, reject) => {
        let ribbon = document.querySelector('button[title="Ribbon"]');
  
        if (ribbon) {
          ribbon.click();
          console.log('-- switching to galleryview --');
  
          return resolve(true);
        }
  
        return reject(true);
      }).then((r) => {
        let xpath = "//span[text()='Gallery']";
        let galleryView = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
  
        if (galleryView && galleryView.singleNodeValue) {
          galleryView.singleNodeValue.click();
        }
      }).catch((error) => {
        console.log('--- error when switching to gallery view --> ', error);
      });
    }
  });}

```

---

_[View the full topic](https://devforum.zoom.us/t/zoom-component-view-not-setting-default-view-as-gallery-no-errors-opens-in-ribbon-view/84157)._
