Replies: 3 comments
-
So two approaches I'm considering.
Then the entity page would be loaded as a Child of Home and if we go back to /main/home it would remove props.children and things would just work. We'd just have to maintain a lot of additional routes like Only tricky part I see is navigate would use relative paths './entity' so it appends to current route. But overall this is least complexity
In our App we could have listeners for when location changes and store the computed props.children - Then if we have a stored version rather than using props.children we'd use the previously rendered version, ignoring props.children and since we don't access props.children it won't try to render anything. This approach is more flexible but requires a bit more complexity managing routes and cache. |
Beta Was this translation helpful? Give feedback.
-
Probably worth looking at this issue too: #204 |
Beta Was this translation helpful? Give feedback.
-
OK Was able to use that and get something like this: <HashRouter
root={(props) => {
rootOwner = getOwner();
return <App {...props} />;
}}
>
function Persist(RawComp) {
let dispose;
return createRoot((_dispose) => {
let node;
dispose = () => {
console.log("disposing");
_dispose();
};
return (props) => {
return runWithOwner(rootOwner, () => {
if (node) {
node.setFocus();
} else {
node = RawComp(props);
}
return node;
});
};
}, rootOwner); Though I'm probably going to go with number 1 as I still need to figure out focus going back. |
Beta Was this translation helpful? Give feedback.
-
I'm using the router with Solid's universal renderer. When I change pages, I'd like to keep the previous page cached, so when the user navigates back to the previous page, it's reusing the previous created page. I'm looking for direction on how to solve this...
Beta Was this translation helpful? Give feedback.
All reactions