Skip to content

Commit

Permalink
hash the state file name
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 committed Sep 25, 2024
1 parent 5e738fd commit 7557836
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion reflex/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import uuid
from abc import ABC, abstractmethod
from collections import defaultdict
from hashlib import md5
from pathlib import Path
from types import FunctionType, MethodType
from typing import (
Expand Down Expand Up @@ -2704,7 +2705,7 @@ def token_path(self, token: str) -> Path:
Returns:
The path for the token.
"""
return (self.states_directory / f"{token}.pkl").absolute()
return (self.states_directory / f"{md5(token.encode())}.pkl").absolute()

async def load_state(self, token: str, root_state: BaseState) -> BaseState:
"""Load a state object based on the provided token.
Expand Down

0 comments on commit 7557836

Please sign in to comment.