smashing
smashing copied to clipboard
Refreshing browser removes widget data until next data push
Describe the bug Refreshing the browser window removes widget data until the next data push from the jobs. This did not occur in Dashing.
To Reproduce Steps to reproduce the behavior:
- smashing start
- load the dashboard in a browser
- post data to the widgets from a dashing job
- Refresh the browser page
- Note that data no longer shows in widget (specifically in my case, the Number widget)
Expected behavior Previously data posted to a widget should persist through a browser refresh
Desktop (please complete the following information):
- OS: macOS Big Sur
- Browser Safari
- Version 14.0.2
- Ruby: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
Additional context it''s common during development to need to refresh the dashboard HTML a lot, and often times the jobs will not run for quite a while, and it can be unnecessarily taxing to re-run some of the jobs just to fill back in the data to test the changes to the view.
Hi @qthatswho good issue description thanks. I think in Dashing it really persisted the data for a while. I will have to try to reproduce it, and then debug. But I remember the history data is kept in a local file in the server, so I expected the latest data to be displayed when refreshing the browser.
Yes, I recall there was some sort of local cache/history file used by Dashing. Is there not a similar mechanism in Smashing? This should be pretty easy to repro.
I think the file is still created. Probably some coffeescript or ruby code changed, and caused the issue. Will try to reproduce it today :+1:
I will add, the widgets where I'm seeing this most reliably are widgets I copied directly from Dashing (pretty basic clones of the Number widget with simple alterations). Not sure if there were any changes in Smashing that might require updates to widgets to properly cache history data.
Trying to reproduce. Installed the gem from master
.
-
smashing new testing
,cd testing
-
smashing start
- visited
http://localhost:3030
- used the jobs & dashboards that come with the default template, replacing the
valuation
in thesample.rb
job-
SCHEDULER.every '10s' do
instead of2s
-
current_valuation = current_valuation + 1
so that every 10 seconds the valuation is increased by1
-
- chose a random number (
$3
), about one second after it appeared, and then pressed the refresh button - the dashboard refreshed, and the valuation (which uses
Number
widget) displayed$3
, then$4
My environment:
OS: Ubuntu LTS 20.04
Browser Firefox 84.0.1
Version `master`, which is really similar to `1.3.0`, the latest version
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
@qthatswho did I miss anything? Here's a GIF showing what I'm seeing.
Been playing with this more. It may be some strange interaction with the layout in concert with another widget (text) on the same row. I ended up duplicating the board and laying it out with the affected widgets (same widget type) all on their own row, and that board refreshes fine. Will update if I can figure out what the difference is where I am reproducing)
Ok, I figured out the difference, I think. On the board where I am able to reproduce, I am updating the Number-esque widgets "subtitle" data-binding (which I had to add in the cloned version of the widget I am using), and when I comment out the send_event for that, strangely, everything refreshes fine and the data persists. The board where this was all working never had the subtitle being updated, so that jives with this theory.