mapbox / mapbox-studio-classic

https://www.mapbox.com/mapbox-studio/
BSD 3-Clause "New" or "Revised" License
1.14k stars 229 forks source link

Autoload local source changes when editing styles #1323

Open nyurik opened 9 years ago

nyurik commented 9 years ago

When designing a style, I frequently need to change the SQL of the local source. Switching back and forth is very inconvenient, so I could simply open another instance of the studio to edit the source. Yet, the first instance is oblivious of the source changes, and does not show them even if I switch to the source in the first instance (potentially causing me to loose my changes).

I think node's fs.watch() should be used to monitor the local source and auto-reload it, unless that same source is being edited locally (in which case the studio should alert the user)

nyurik commented 9 years ago

A quick and dirty hack would be to edit resources/app/lib/source.js and comment out line 99: if (cache[id]) return callback(null, cache[id]); - this way CTRL+R can be used to refresh the style result after saving it in the second schema editing instance.

springmeyer commented 9 years ago

Thanks for the feedback and ideas! Just about to head off for the night so I'll just share a few tips:

screen shot 2015-04-27 at 9 39 54 pm

Note: to clear the cache manually you are remove this folder: ~/.mapbox-studio/cache

samanpwbb commented 9 years ago

Wonder if there is a small change we cna make to make teh purpose of the refresh icon clearer in the UI, cc: @amyleew

nyurik commented 9 years ago

@springmeyer thanks for the browser idea, i should have thought of that! :) As for refresh button - I seems very useful if mbtiles are remote, or when the actual source of data changes (e.g. SQL db update), but I think dynamic updates are much better (e.g. opening screens side by side, and clicking save instantly updates the other screen). Thanks for all the replies!!!