Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion custom_components/pyscript/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,11 @@ def check_event(event: FileSystemEvent, do_reload: bool) -> bool:
return do_reload
return True
# only reload if it's a script, yaml, or requirements.txt file
# also check dest_path: atomic saves (tempfile + os.replace) surface
# as a moved event whose src_path is an unrelated temp name
paths = (event.src_path, event.dest_path)
for valid_suffix in [".py", ".yaml", "/" + REQUIREMENTS_FILE]:
if event.src_path.endswith(valid_suffix):
if any(path.endswith(valid_suffix) for path in paths):
return True
return do_reload

Expand Down
Loading