epicweb-dev / epicweb-dev/restore-scroll
I don't know what's wrong
- Dominant language
- TypeScript
- Stars
- 260
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
I tried to use it, with React router v6
so, i have router config with createBrowserRouter:
```js
const router = createBrowserRouter([
{
path: '/',
element: ,
children: [
{
path: '/',
element: ,
},
{
path: '/dashboard',
element: ,
},
],
},
]);
```
then in the Home component i'm rendering a chat:
```jsx
{renderHelper}
```
The `renderHelper` only makes some validating, and insert prompts and answers, it scrolls, cool, but when i nav to Dashboard, and comeback to Home, the scroll position is not saved, it at top
I will provide a Codesandbox later, but i don't know if i can recreate the exact thing, because it's a bigger project, with many things rappening on the chat.
But i think the scroll part is this, the #chatContainer, render on page load, and stays there forever, even if has no messages, so the reference to the `ElementScrollRestoration` exists
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.