Skip to content

Commit

Permalink
Merge pull request #523 from AnswerDotAI/fix
Browse files Browse the repository at this point in the history
Simplify `with_sid`
  • Loading branch information
jph00 authored Oct 16, 2024
2 parents 1a51b0c + fdca56d commit e511601
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions fasthtml/xtend.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,5 @@ def clear(id): return Div(hx_swap_oob='innerHTML', id=id)

# %% ../nbs/api/02_xtend.ipynb
def with_sid(app, dest, path='/'):
id = unqid()
@app.route(path)
def get():
return Div(id=id, hx_get=dest, hx_trigger=f'load delay:0.001s', hx_target=f'#{id}', hx_swap='outerHTML')
def get(): return Div(hx_get=dest, hx_trigger=f'load delay:0.001s', hx_swap='outerHTML')
6 changes: 2 additions & 4 deletions nbs/api/02_xtend.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,10 @@
"metadata": {},
"outputs": [],
"source": [
"#| export\n",
"#|export\n",
"def with_sid(app, dest, path='/'):\n",
" id = unqid()\n",
" @app.route(path)\n",
" def get():\n",
" return Div(id=id, hx_get=dest, hx_trigger=f'load delay:0.001s', hx_target=f'#{id}', hx_swap='outerHTML')"
" def get(): return Div(hx_get=dest, hx_trigger=f'load delay:0.001s', hx_swap='outerHTML')"
]
},
{
Expand Down

0 comments on commit e511601

Please sign in to comment.