Skip to content

Commit

Permalink
feat: speed up sources reloading process
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 committed Aug 23, 2024
1 parent c3a8371 commit d8547db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 7 additions & 1 deletion reasonify-headless/load.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from functools import cache
from os import chdir
from pathlib import Path
Expand All @@ -15,12 +16,17 @@ def with_toast[**Params, Return](message: str) -> Callable[[Callable[Params, Ret


for path, source in sources.items():
file = Path(path)
file = Path("/home/pyodide", path)
if not file.parent.is_dir():
file.parent.mkdir(parents=True)
file.write_text(source, "utf-8")


if __debug__:
for module in tuple(sys.modules): # for HMR
if module.startswith("reasonify"):
sys.modules.pop(module).__dict__.clear()

if TYPE_CHECKING:

class NativeFS:
Expand Down
3 changes: 0 additions & 3 deletions src/lib/components/Chat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
async function refresh() {
refreshing = true;
try {
getPy.invalidateCache();
globalCache.clear();
$pyodideReady = false;
$reasonifyReady = false;
chain = await initChain();
} finally {
Expand Down

0 comments on commit d8547db

Please sign in to comment.