Skip to content

Commit

Permalink
Fix race condition in visualisation message order
Browse files Browse the repository at this point in the history
  • Loading branch information
cyderize committed Sep 15, 2023
1 parent 096c883 commit 2e7e2b5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
48 changes: 38 additions & 10 deletions src/lib/Playground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,15 @@
minizinc.cancel();
}
let visQueue = null;
function addOutput(value, time) {
processVisMessage(value, time);
if (visQueue) {
visQueue.then(() => {
visQueue = processVisMessage(value, time);
});
} else {
visQueue = processVisMessage(value, time);
}
output[output.length - 1].output.push(value);
output = output; // Force update
}
Expand Down Expand Up @@ -1065,7 +1072,10 @@
class:is-active={menuActive}
aria-label="menu"
aria-expanded={menuActive}
on:click={() => {menuActive = !menuActive; showSolverConfig = false;}}
on:click={() => {
menuActive = !menuActive;
showSolverConfig = false;
}}
>
<span aria-hidden="true" />
<span aria-hidden="true" />
Expand Down Expand Up @@ -1135,7 +1145,10 @@
<a
class="navbar-item is-hidden-tablet mobile-menu-item"
href="javascript:void(0);"
on:click={() => { compile(); menuActive = false}}
on:click={() => {
compile();
menuActive = false;
}}
>
<span class="icon">
<Fa icon={faHammer} />
Expand All @@ -1148,7 +1161,10 @@
<a
class="navbar-item is-hidden-tablet mobile-menu-item"
href="javascript:void(0);"
on:click={() => {toggleSolverConfig(); menuActive = false}}
on:click={() => {
toggleSolverConfig();
menuActive = false;
}}
>
<span class="icon">
<Fa icon={faCog} />
Expand All @@ -1161,23 +1177,32 @@
<a
class="navbar-item is-hidden-tablet mobile-menu-item"
href="javascript:void(0);"
on:click={() => {edgeMiniZinc = !edgeMiniZinc; menuActive = false;}}
on:click={() => {
edgeMiniZinc = !edgeMiniZinc;
menuActive = false;
}}
>
<span class="icon">
<Fa icon={faShuffle} />
</span>
<span>Switch to the {edgeMiniZinc ? 'latest' : 'edge'} version of MiniZinc</span>
<span
>Switch to the {edgeMiniZinc
? 'latest'
: 'edge'} version of MiniZinc</span
>
</a>
{/if}
{#if showShareButton && busyState === 0}
<!-- svelte-ignore a11y-invalid-attribute -->
<a
class="navbar-item is-hidden-tablet mobile-menu-item"
href="javascript:void(0);"
on:click={() =>
{shareUrl = getShareUrl(
on:click={() => {
shareUrl = getShareUrl(
window.location.href
);menuActive = false;}}
);
menuActive = false;
}}
>
<span class="icon">
<Fa icon={faShareNodes} />
Expand All @@ -1190,7 +1215,10 @@
<a
class="navbar-item is-hidden-tablet mobile-menu-item"
href="javascript:void(0);"
on:click={() => {openInExternalPlayground(); menuActive = false}}
on:click={() => {
openInExternalPlayground();
menuActive = false;
}}
>
<span class="icon">
<Fa icon={faArrowUpRightFromSquare} />
Expand Down
1 change: 0 additions & 1 deletion src/lib/SplitPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
function init(direction, showPanels) {
cleanup();
if (showPanels === 'all' && panelA && panelB) {
console.log(direction);
instance = Split([panelA, panelB], {
direction,
minSize: 0,
Expand Down

0 comments on commit 2e7e2b5

Please sign in to comment.