Open template upon creation, only show <ContentPreviewSelector/> for templates, update editor frame preview when switching content
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3547085. --> Reported by: [hooroomoo](https://www.drupal.org/user/3688872) Related to !97 >>> <h3 id="overview">Overview</h3> <p>This issue will address 3 things:<br> 1. Opening the content template in the editor frame preview after a user adds a template.<br> 2. Address the bug detailed below<br> 3. Update editor frame preview (full page reload until FE routing can be fully done) when switching content using the ContentPreviewSelector</p> <p><img src="https://www.drupal.org/files/issues/2025-09-16/Screenshot%202025-09-16%20at%205.18.12%E2%80%AFPM.png" alt="sc"></p> <p>To reproduce:<br> 1. Add a new content template then open the template in the editor frame.<br> 2. Click Add in the sidebar (+ icon) and click "Create code component" to create a new code component<br> 3. Creating a code component should open up the code editor. You can see that the content preview navigation is rendered in the top.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>We use the selector <code>selectEditorFrameContext</code> to determine whether we are on a template or entity. The TopBar correctly checks whether we are on a template to show the <code>&lt;ContentPreviewSelector/&gt;</code>. However the value is incorrectly set to 'template' when the code editor is open because it doesn't get updated.</p> <p>I believe all we need is in <code>code-editor/Preview.tsx</code>, inside the useEffect without dependencies, we want to call setEditorFrameContext and set it to something else. </p> <p>This might require introducing a third enum to <code>EditorFrameContext</code> in uiSlice.ts. Either an "undefined" which acts as neither or adding a "CODE" enum.</p> <h3 id="ui-changes">User interface changes</h3> > Related issue: [Issue #3541000](https://www.drupal.org/node/3541000)
issue