From 77b7375a0294f7ef0a95311d6ad7034189d721f4 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 26 Aug 2019 17:15:48 +0200 Subject: [PATCH 1/2] Only load header once --- resources/js/screens/dumps/index.vue | 7 +++++++ src/Http/Controllers/DumpController.php | 12 +++++++++++- src/Watchers/DumpWatcher.php | 7 +++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/resources/js/screens/dumps/index.vue b/resources/js/screens/dumps/index.vue index 197fcc067..d0f243c5e 100644 --- a/resources/js/screens/dumps/index.vue +++ b/resources/js/screens/dumps/index.vue @@ -7,6 +7,7 @@ */ data() { return { + dump: null, entries: [], ready: false, newEntriesTimeout: null, @@ -39,6 +40,7 @@ loadEntries(){ axios.post(Telescope.basePath + '/telescope-api/dumps').then(response => { this.ready = true; + this.dump = response.data.dump; this.entries = response.data.entries; this.recordingStatus = response.data.status; @@ -102,8 +104,13 @@ We didn't find anything - just empty space. +
+
+
+
+
diff --git a/src/Http/Controllers/DumpController.php b/src/Http/Controllers/DumpController.php index 03c439d98..37e6ad966 100644 --- a/src/Http/Controllers/DumpController.php +++ b/src/Http/Controllers/DumpController.php @@ -6,6 +6,9 @@ use Illuminate\Cache\ArrayStore; use Laravel\Telescope\EntryType; use Laravel\Telescope\Watchers\DumpWatcher; +use Laravel\Telescope\Storage\EntryQueryOptions; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; use Laravel\Telescope\Contracts\EntriesRepository; use Illuminate\Contracts\Cache\Repository as CacheRepository; @@ -40,7 +43,14 @@ public function index(Request $request, EntriesRepository $storage) { $this->cache->put('telescope:dump-watcher', true, now()->addSeconds(4)); - return parent::index($request, $storage); + return response()->json([ + 'dump' => (new HtmlDumper())->dump((new VarCloner)->cloneVar(true), true), + 'entries' => $storage->get( + $this->entryType(), + EntryQueryOptions::fromRequest($request) + ), + 'status' => $this->status(), + ]); } /** diff --git a/src/Watchers/DumpWatcher.php b/src/Watchers/DumpWatcher.php index eeaf6c9cf..87b157704 100644 --- a/src/Watchers/DumpWatcher.php +++ b/src/Watchers/DumpWatcher.php @@ -44,8 +44,11 @@ public function register($app) return; } - VarDumper::setHandler(function ($var) { - $this->recordDump((new HtmlDumper)->dump( + $htmlDumper = new HtmlDumper(); + $htmlDumper->setDumpHeader(''); + + VarDumper::setHandler(function ($var) use($htmlDumper) { + $this->recordDump($htmlDumper->dump( (new VarCloner)->cloneVar($var), true )); }); From e2587c517c676a4f7308f27aee38c4cba26de308 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 26 Aug 2019 10:38:13 -0500 Subject: [PATCH 2/2] Update DumpWatcher.php --- src/Watchers/DumpWatcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Watchers/DumpWatcher.php b/src/Watchers/DumpWatcher.php index 87b157704..f561995dd 100644 --- a/src/Watchers/DumpWatcher.php +++ b/src/Watchers/DumpWatcher.php @@ -47,7 +47,7 @@ public function register($app) $htmlDumper = new HtmlDumper(); $htmlDumper->setDumpHeader(''); - VarDumper::setHandler(function ($var) use($htmlDumper) { + VarDumper::setHandler(function ($var) use ($htmlDumper) { $this->recordDump($htmlDumper->dump( (new VarCloner)->cloneVar($var), true ));