File tree Expand file tree Collapse file tree 2 files changed +33
-5
lines changed
Expand file tree Collapse file tree 2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 1010 ],
1111 "require" : {
1212 "illuminate/console" : " >5.3" ,
13- "barryvdh/laravel-debugbar" : " >2.4"
13+ "barryvdh/laravel-debugbar" : " >2.4" ,
14+ "clue/stdio-react" : " ^2.1"
1415 },
1516 "autoload" : {
1617 "psr-4" : {
Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ class Debug extends Command
3333 */
3434 private $ repository ;
3535
36+ /**
37+ * @var null|string
38+ */
39+ private $ currentRequest = null ;
40+
3641 /**
3742 * @param \Madewithlove\LaravelDebugConsole\StorageRepository $repository
3843 */
@@ -54,8 +59,14 @@ public function handle()
5459 while (true ) {
5560 $ data = $ this ->repository ->latest ();
5661
57- // Make sure the screen is clean
58- $ this ->refresh ();
62+ // Checks if its a new request
63+ if ($ this ->isNewRequest (array_get ($ data , '__meta.id ' ))) {
64+ $ this ->refresh ();
65+ } else {
66+ $ this ->wait ();
67+
68+ continue ;
69+ }
5970
6071 (new General ($ this ->input , $ this ->output ))->render ($ data );
6172
@@ -82,14 +93,30 @@ public function handle()
8293 }
8394 }
8495
85- public function wait ()
96+ private function wait ()
8697 {
8798 sleep (1 );
8899 }
89100
90- public function refresh ()
101+ private function refresh ()
91102 {
92103 $ this ->wait ();
93104 system ('clear ' );
94105 }
106+
107+ /**
108+ * @param $id
109+ *
110+ * @return bool
111+ */
112+ private function isNewRequest ($ id )
113+ {
114+ if (empty ($ this ->currentRequest ) || $ this ->currentRequest !== $ id ) {
115+ $ this ->currentRequest = $ id ;
116+
117+ return true ;
118+ }
119+
120+ return false ;
121+ }
95122}
You can’t perform that action at this time.
0 commit comments