Skip to content

Commit

Permalink
Merge pull request #603 from plotly/hot-reload-dist
Browse files Browse the repository at this point in the history
Add component packages dist to hot reload watch.
  • Loading branch information
T4rk1n authored Feb 13, 2019
2 parents 9324643 + 5520e98 commit 5a6491d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
- Fix missing component prop docstring error [#598](https://github.com/plotly/dash/issues/598)
- Moved `__repr__` to base component instead of being generated. [#492](https://github.com/plotly/dash/pull/492)

## Added
- Added components libraries js/css distribution to hot reload watch. [#603](https://github.com/plotly/dash/pull/603)

## [0.37.0] - 2019-02-11
## Fixed
- Fixed collections.abc deprecation warning for python 3.8 [#563](https://github.com/plotly/dash/pull/563)
Expand Down
15 changes: 13 additions & 2 deletions dash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from .dependencies import Input, Output, State
from .resources import Scripts, Css
from .development.base_component import Component
from .development.base_component import Component, ComponentRegistry
from . import exceptions
from ._utils import AttributeDict as _AttributeDict
from ._utils import interpolate_str as _interpolate
Expand Down Expand Up @@ -1155,9 +1155,20 @@ def enable_dev_tools(self,

if self._dev_tools.hot_reload:
self._reload_hash = _generate_hash()

component_packages_dist = [
os.path.dirname(package.path)
if hasattr(package, 'path')
else package.filename
for package in (
pkgutil.find_loader(x) for x in
list(ComponentRegistry.registry) + ['dash_renderer']
)
]

self._watch_thread = threading.Thread(
target=lambda: _watch.watch(
[self._assets_folder],
[self._assets_folder] + component_packages_dist,
self._on_assets_change,
sleep_time=self._dev_tools.hot_reload_watch_interval)
)
Expand Down

0 comments on commit 5a6491d

Please # to comment.