smashing icon indicating copy to clipboard operation
smashing copied to clipboard

Refreshing browser removes widget data until next data push

Open qthatswho opened this issue 4 years ago • 7 comments

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:

  1. smashing start
  2. load the dashboard in a browser
  3. post data to the widgets from a dashing job
  4. Refresh the browser page
  5. 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.

qthatswho avatar Jan 07 '21 23:01 qthatswho

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.

kinow avatar Jan 07 '21 23:01 kinow

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.

qthatswho avatar Jan 07 '21 23:01 qthatswho

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:

kinow avatar Jan 07 '21 23:01 kinow

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.

qthatswho avatar Jan 08 '21 00:01 qthatswho

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 the sample.rb job
    • SCHEDULER.every '10s' do instead of 2s
    • current_valuation = current_valuation + 1 so that every 10 seconds the valuation is increased by 1
  • 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.

GIFrecord_2021-01-08_152023

kinow avatar Jan 08 '21 02:01 kinow

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)

qthatswho avatar Jan 08 '21 02:01 qthatswho

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.

qthatswho avatar Jan 08 '21 02:01 qthatswho