Open 18601673727 opened 6 months ago
Might be helpful to share my current workaround
// ...other imports
import { useEventListener, useSessionStorage } from "usehooks-ts";
export const DataView = (props: { initialData: ServerDataType[] }) => {
const [value, setValue, removeValue] = useSessionStorage(
"server-data",
props.initialData
);
useEventListener("beforeunload", removeValue);
async function loadMore() {
// ...same rest
}
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/naughty-sid-dz4xtn
To Reproduce
Load more
/blog/10
Current vs. Expected behavior
Current: Inconsistent states/Unexpected Rerendering Expected: Back Button behaves like usual websites do(bfcache)
Provide environment information
Which area(s) are affected? (Select all that apply)
Navigation, App Router, Cache
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local), Vercel (Deployed), Other (Deployed)