diff --git a/src/py/reactpy/reactpy/core/hooks.py b/src/py/reactpy/reactpy/core/hooks.py index 7279b0191..f0434789f 100644 --- a/src/py/reactpy/reactpy/core/hooks.py +++ b/src/py/reactpy/reactpy/core/hooks.py @@ -3,6 +3,7 @@ import asyncio from functools import lru_cache import hashlib +import linecache import sys from collections.abc import Coroutine, Sequence from hashlib import md5 @@ -102,8 +103,11 @@ def get_caller_info(): patch_path = render_frame.f_locals.get("patch_path_for_state") if patch_path is not None: break - # Extract the relevant information: file path and line number and hash it - return f"{caller_frame.f_code.co_filename} {caller_frame.f_lineno} {patch_path}" + # Extract the relevant information: file path, line number, and line and hash it + filename = caller_frame.f_code.co_filename + lineno = caller_frame.f_lineno + line = linecache.getline(filename, lineno) + return f"{filename} {lineno} {line}, {patch_path}" __DEBUG_CALLER_INFO_TO_STATE_KEY = {}