Skip to content

Commit

Permalink
fix 404 page on back
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Dec 1, 2023
1 parent 49f2239 commit 3c81c8d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/fastui-bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pydantic/fastui-bootstrap",
"version": "0.0.7",
"version": "0.0.8",
"description": "Boostrap renderer for FastUI",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -29,6 +29,6 @@
"sass": "^1.69.5"
},
"peerDependencies": {
"@pydantic/fastui": "0.0.7"
"@pydantic/fastui": "0.0.8"
}
}
2 changes: 1 addition & 1 deletion packages/fastui-prebuilt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pydantic/fastui-prebuilt",
"version": "0.0.7",
"version": "0.0.8",
"description": "Pre-built files for FastUI",
"main": "dist/index.html",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/fastui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pydantic/fastui",
"version": "0.0.7",
"version": "0.0.8",
"description": "Build better UIs faster.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
6 changes: 6 additions & 0 deletions packages/fastui/src/components/ServerLoad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DefaultSpinner, DefaultNotFound, DefaultTransition } from '../Defaults'
import { ConfigContext } from '../hooks/config'
import { PageEvent, usePageEventListen } from '../events'
import { EventContextProvider, useEventContext } from '../hooks/eventContext'
import { LocationContext } from '../hooks/locationContext'

import { AnyCompList, FastProps } from './index'

Expand Down Expand Up @@ -51,6 +52,7 @@ export const ServerLoadFetch: FC<{ path: string; devReload?: number }> = ({ path
const [componentProps, setComponentProps] = useState<FastProps[] | null>(null)
const [notFoundUrl, setNotFoundUrl] = useState<string | undefined>(undefined)

const { fullPath } = useContext(LocationContext)
const url = useServerUrl(path)
const request = useRequest()

Expand All @@ -71,6 +73,10 @@ export const ServerLoadFetch: FC<{ path: string; devReload?: number }> = ({ path
}
}, [url, request, devReload])

useEffect(() => {
setNotFoundUrl(undefined)
}, [fullPath])

return <Render propsList={componentProps} notFoundUrl={notFoundUrl} transitioning={transitioning} />
}

Expand Down
2 changes: 1 addition & 1 deletion python/fastui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class FastUI(pydantic.RootModel):
root: list[AnyComponent]


_PREBUILT_VERSION = '0.0.7'
_PREBUILT_VERSION = '0.0.8'
_PREBUILT_CDN_URL = f'https://cdn.jsdelivr.net/npm/@pydantic/fastui-prebuilt@{_PREBUILT_VERSION}/dist/assets'


Expand Down

0 comments on commit 3c81c8d

Please sign in to comment.