From e3b1a47554b8ec6282f02d0d537cf7e1777e8983 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Thu, 6 Apr 2023 16:30:30 +0200 Subject: [PATCH] Playground improvements --- .../website/pages/playground/PlaygroundModel.ts | 2 +- .../pages/playground/PlaygroundPageContent.tsx | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/website/src/website/pages/playground/PlaygroundModel.ts b/website/src/website/pages/playground/PlaygroundModel.ts index d94a9988..7cb6cbf0 100644 --- a/website/src/website/pages/playground/PlaygroundModel.ts +++ b/website/src/website/pages/playground/PlaygroundModel.ts @@ -140,7 +140,7 @@ export class PlaygroundModel { } } - private readonly debouncer = new Debouncer(250); + private readonly debouncer = new Debouncer(700); @observable public isDirty = false; diff --git a/website/src/website/pages/playground/PlaygroundPageContent.tsx b/website/src/website/pages/playground/PlaygroundPageContent.tsx index e93c0d4a..3c1039d5 100644 --- a/website/src/website/pages/playground/PlaygroundPageContent.tsx +++ b/website/src/website/pages/playground/PlaygroundPageContent.tsx @@ -133,10 +133,16 @@ export class PlaygroundPageContent extends React.Component< checked={ model.settings.autoReload } - onChange={(e) => - (model.settings.autoReload = - e.target.checked) - } + onChange={(e) => { + model.settings.autoReload = + e.target.checked; + if ( + e.target.checked && + model.isDirty + ) { + model.reload(); + } + }} /> )}