ayushsharma82 / ESP-DASH

Blazing fast library to create a functional dashboard for ESP8266 / ESP32
https://espdash.pro
GNU General Public License v3.0
976 stars 200 forks source link

[BUG] not refreshing on dynamic change in number of cards/charts #150

Closed petersoltys closed 1 year ago

petersoltys commented 1 year ago

after short investigation I have find out that command generated in arduino is not the same as in javascript here is patch

diff --git a/src/ESPDash.cpp b/src/ESPDash.cpp
index 9d7faed..0e2ea93 100644
--- a/src/ESPDash.cpp
+++ b/src/ESPDash.cpp
@@ -437,7 +437,7 @@ void ESPDash::sendUpdates(bool force) {
 }

 void ESPDash::refreshLayout() {
-  _ws->textAll("{\"command\":\"refreshLayout\"}");
+  _ws->textAll("{\"command\":\"refresh:layout\"}");
 }

 void ESPDash::refreshStatistics() {
Zen-Ong commented 1 year ago

Hi I am new to programming, and facing the same issue regarding (layout is not refreshing during the dynamic change in number of cards), may I know how did you fix this issue.

petersoltys commented 1 year ago

Hi Zen, sure no problem. there is simply difference in tag inside source code of browser JS and arduino C++ code. as visible in patch simply replace line

_ws->textAll("{\"command\":\"refreshLayout\"}");

with updated tag name

_ws->textAll("{\"command\":\"refresh:layout\"}");

Zen-Ong commented 1 year ago

Thanks for the explanation, it works for me now.

ayushsharma82 commented 1 year ago

Fixed with this commit: https://github.com/ayushsharma82/ESP-DASH/commit/21fe2f6ea816d2bd583dadb21db0f81d6b6654e2

Thanks for pointing out!