Jelajahi Sumber

debugging: show before and after packages

Masen Furer 4 bulan lalu
induk
melakukan
be30878c84
1 mengubah file dengan 8 tambahan dan 3 penghapusan
  1. 8 3
      reflex/utils/exec.py

+ 8 - 3
reflex/utils/exec.py

@@ -82,6 +82,9 @@ def run_process_and_launch_url(run_command: list[str], backend_present=True):
 
 
     json_file_path = get_web_dir() / constants.PackageJson.PATH
     json_file_path = get_web_dir() / constants.PackageJson.PATH
     last_hash = detect_package_change(json_file_path)
     last_hash = detect_package_change(json_file_path)
+    console.print(
+        f"DETECT_PACKAGE_CHANGE init {last_hash}, {json.dumps(json.loads(json_file_path.read_text()))}"
+    )
     process = None
     process = None
     first_run = True
     first_run = True
 
 
@@ -126,13 +129,15 @@ def run_process_and_launch_url(run_command: list[str], backend_present=True):
                         )
                         )
                     new_hash = detect_package_change(json_file_path)
                     new_hash = detect_package_change(json_file_path)
                     if new_hash != last_hash:
                     if new_hash != last_hash:
+                        console.print("Reloading app due to new content...")
+                        new_content = json.dumps(json.loads(json_file_path.read_text()))
+                        console.print(
+                            f"DETECT_PACKAGE_CHANGE hit {last_hash} != {new_hash} (new), {new_content}"
+                        )
                         last_hash = new_hash
                         last_hash = new_hash
-                        console.print("Reloading app...")
                         kill(process.pid)
                         kill(process.pid)
                         process = None
                         process = None
                         break  # for line in process.stdout
                         break  # for line in process.stdout
-                    else:
-                        console.print(f"No change: {line}")
         if process is not None:
         if process is not None:
             break  # while True
             break  # while True