ITADN

rx.markdown crash when display content in rx.State

#6587Opensuc1 创建于 2026-05-29
S
suc1commented
**Describe the bug** ``` [Reflex Frontend Exception] Assertion: Unexpected value `` for `children` prop, expected `string` Assertion: Unexpected value `` for `children` prop, expected `string` at assert (http://localhost:3000/node_modules/.vite/deps/development-Cjbcu6kc.js?v=acd41aed:93:64) at unreachable (http://localhost:3000/node_modules/.vite/deps/development-Cjbcu6kc.js?v=acd41aed:74:2) at createFile (http://localhost:3000/node_modules/.vite/deps/react-markdown.js?v=acd41aed:13621:7) at Markdown (http://localhost:3000/node_modules/.vite/deps/react-markdown.js?v=acd41aed:13529:15) at Object.react_stack_bottom_frame (http://localhost:3000/node_modules/.vite/deps/react-dom_client.js?v=acd41aed:12868:12) at renderWithHooks (http://localhost:3000/node_modules/.vite/deps/react-dom_client.js?v=acd41aed:4213:19) at updateFunctionComponent (http://localhost:3000/node_modules/.vite/deps/react-dom_client.js?v=acd41aed:5569:16) at beginWork (http://localhost:3000/node_modules/.vite/deps/react-dom_client.js?v=acd41aed:6140:20) at runWithFiberInDEV (http://localhost:3000/node_modules/.vite/deps/react-dom_client.js?v=acd41aed:851:66) at performUnitOfWork (http://localhost:3000/node_modules/.vite/deps/react-dom_client.js?v=acd41aed:8429:92) ``` **To Reproduce** `load_static_page/[swp_id]` load different file according to `swp_id`. `rx.text` is ok but `rx.markdown` crash. **Code** ``` class LoadStaticPageState(rx.State): page_content: str = '' @rx.event def load_page(self) -> None: # Router URL: http://localhost:3000/load_static_page/design_recipe urlPath = self.router.url.path swp_id = urlPath.rstrip("/").split("/")[-1] # swp_id = self.router.url.query_parameters.get("swp_id", 'install') # why not work file_name = self._pages.get(swp_id, 'webPages/install.md') fp = ASSETS_DIR / file_name self.page_content = fp.read_text(encoding="utf-8") @rx.page(route=f"load_static_page/[swp_id]", on_load=LoadStaticPageState.load_page, ) def LoadStaticPage() -> rx.Component: # load_static_page/[swp_id] # static web page id # load_static_page/design_largeModel content = LoadStaticPageState.page_content my_child = rx.markdown(content) # crash # my_child = rx.text(content) # ok return my_child ``` **Specifics (please complete the following information):** - Python Version: 3.13.7 - Reflex Version: 0.9.2.post1 - OS: Windows 11 - Browser (Optional): Edge **Additional context** The markdown file is ok on 0.8 reflex
1 条评论