server side fixes

This commit is contained in:
Seth Trowbridge 2023-05-14 07:26:18 -04:00
parent b51e469632
commit 31c9f8fc07
3 changed files with 15 additions and 5 deletions

View File

@ -23,6 +23,9 @@ const Comp = React.lazy(()=>import("./deep/component.tsx"));
export default ()=>
{
const [stack] = React.useContext(Iso.Meta.Context);
return <div class="p-4 font-sans">
<Iso.Meta.Metas title="Main Page!" description="its great"/>
<nav class="p-4">
@ -48,7 +51,12 @@ export default ()=>
</Iso.Switch>
</Iso.Case>
<Iso.Case value="lol/idk">lol/idk</Iso.Case>
<Iso.Case default><p>404!</p></Iso.Case>
<Iso.Case default>
<>
<Iso.Meta.Metas description="a 404 has occurred"/>
<p>404!</p>
</>
</Iso.Case>
</Iso.Switch>
</div>;
};

View File

@ -13,7 +13,7 @@ export default ()=>
console.log("component.tsx render!!")
return <div class="p-4 text-red-500">
<Iso.Meta.Metas title="Component!"/>
<Iso.Meta.Metas title="Component!" description="components can set metas"/>
Component Route is: {routeGet.Path.toString()}
<button className="p-4 bg-green-500 text-white" onClick={e=>{countSet(countGet+1); routeSet(["lol", "idk"], {count:countGet+1});}}>{countGet}</button>
<a href="/page/about-us" className="p-2 text(lg blue-500) font-bold">a link</a>

View File

@ -372,7 +372,8 @@ else if(App && TwindInst)
Iso.Fetch.ServerTouched = new Set();
Iso.Fetch.ServerRemove = new Set();
let app = <Iso.Router.Provider url={url}><App/></Iso.Router.Provider>;
await Prepass(app)
await Prepass(app);
Iso.Meta.Stack = [];
let bake = SSR(app);
while(Iso.Fetch.ServerBlocking.length)
{
@ -381,7 +382,8 @@ else if(App && TwindInst)
// at this point, anything that was requested that was not cached, has now been loaded and cached
// this next render will use cached resources. using a cached resource (if its "Seed" is true) adds it to the "touched" set.
app = <Iso.Router.Provider url={url}><App/></Iso.Router.Provider>;
await Prepass(app)
await Prepass(app);
Iso.Meta.Stack = [];
bake = SSR(app);
}
@ -394,7 +396,7 @@ else if(App && TwindInst)
Iso.Fetch.ServerTouched = false;
Iso.Meta.Meta = Iso.Meta.ComputeFinal(Iso.Meta.Stack);
console.log(Iso.Meta.Stack);
const results = Twind.extract(bake, TwindInst);
type = `text/html`;