Skip to content

Commit

Permalink
Misc fixes (#212)
Browse files Browse the repository at this point in the history
* Misc fixes

* Add comment

* Fix for cancelled panels
  • Loading branch information
eatonphil committed Apr 6, 2022
1 parent fe6b642 commit 59010dd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions ui/PageList.tsx
Expand Up @@ -59,6 +59,10 @@ export function makeReevalPanel(
// Important! Just needs to trigger a state reload.
updatePanelInternal(panel);

if (panel.resultMeta.exception) {
return;
}

// Re-run all dependent visual panels
if (!VISUAL_PANELS.includes(panel.type)) {
for (const dep of page.panels) {
Expand Down
11 changes: 9 additions & 2 deletions ui/Panel.tsx
Expand Up @@ -306,7 +306,14 @@ export function Panel({
async function evalThis() {
if (killable) {
await killProcess();
setLoading(false);

// Only don't reeval if we think it's already not running. //
// This allows the UI to kill any background running process that
// might have started on a different page or something like that.
if (loading) {
setLoading(false);
return;
}
}

setLoading(true);
Expand Down Expand Up @@ -416,7 +423,7 @@ export function Panel({
</Button>
</span>

<label className="ml-2 text-muted">
<label className="ml-2 text-muted" title={panel.id}>
{PANEL_UI_DETAILS[panel.type].label}
</label>

Expand Down
2 changes: 1 addition & 1 deletion ui/PanelList.tsx
Expand Up @@ -139,7 +139,7 @@ export function PanelList({
});
}

updatePanel(next, panelIndex, true);
updatePanel(next, panelIndex + 1, true);
}

const offerToTable =
Expand Down
2 changes: 1 addition & 1 deletion ui/app.tsx
Expand Up @@ -165,7 +165,7 @@ export function App<T extends DefaultView = DefaultView>({
>
<div className={`app app--${MODE} app--${settings.theme}`}>
{MODE_FEATURES.appHeader && <Header />}
<main className={'view-' + (urlState.view || 'editor')}>
<main className={'view view-' + (urlState.view || 'editor')}>
{urlState.projectId && <Navigation pages={routes} />}
{main}
</main>
Expand Down
7 changes: 7 additions & 0 deletions ui/components/CodeEditor.tsx
Expand Up @@ -84,7 +84,14 @@ export function CodeEditor({
return;
}

// Without this the clearSelection call below moves the cursor to the end of the textarea destroying in-action edits
if (editorNode.editor.container.contains(document.activeElement)) {
return;
}

editorNode.editor.setValue(value);
// setValue() also highlights the inserted values so this gets rid
// of the highlight. Kind of a weird API really
editorNode.editor.clearSelection();
}, [value, editorNode]);

Expand Down
5 changes: 5 additions & 0 deletions ui/style.css
Expand Up @@ -78,6 +78,11 @@ a:hover {
display: block;
}

.view {
/* Very important! Gives the main panel list it's overflow so it scrolls independent of the sidebar */
width: 100%;
}

.main-body {
flex: 1;
overflow-y: auto;
Expand Down

0 comments on commit 59010dd

Please sign in to comment.