sabercoy
Explore posts from serversCDCloudflare Developers
•Created by sabercoy on 10/15/2024 in #pages-help
How to set up auth for static files
heres my dist folder if it helps
3 replies
How does Transition API and createAsync interact?
hmm.. Im curious then what actually kicks off the transition, is it the invoking of the transition start function, or is it the awaiting of an async function
seems from the logs the transition didnt start until it hit the await
from there it seems, from what you said, that we enter into a separate execution context and lose contact with the old one
I understand what transitions do on a high level, like hold on to the old state and view while the new one is being processed, then swap
but as far as how it works under the hood in terms of the JS language/runtime I dunno XD
7 replies
"Cannot call server function outside of a request" in onRequest middlware hook
I just got this, found out it was from calling a server function (a function marked with 'use server') inside of middleware
I guess you cannot call server functions in middleware
this looks like it is your case seeing that an error occured in "onRequest"
3 replies
Returning Errors and not throwing
hmm I didnt even know submission.clear was a thing
I see in the no-JS case it really is not meaningful (the page you got is the result of the submission)
but in the JS case the submissions seem to stack on themselves and are popped with clear()
8 replies
Returning Errors and not throwing
thanks for this example, in looking at this I have discovered the key is that the behavior under the hood of SS is different depending on JS being enabled
if enabled, it sends a fetch request, and in the response it has the information needed to dynamically update the UI in the spot of the read submission (in 1 request)
if disabled, it sends a request, and in the response is instructed to refetch the same page which will have the UI updated in the spot of the read submission (it takes 2 requests)
that covers the useSubmission and render the updated page on the server, but now there is returning the Error vs throwing. I see this decision as ultimately deciding to use submission.result or submission.error. The only reason I can see to return the Error is you will get the type information in the result, where as if you throw, the error would still just be any
8 replies
Returning Errors and not throwing
I understand PE, and I understand the stated desire to handle Errors with normal control flow
I do not understand how this gets incorporated, in code, with SolidStart's primitives (action and useSubmission)
My understanding is that a server-action is called from a form that is on the client. Now we are in the server handling the action, and now we run into an Error. Even if I choose to return this error and not throw it, how is it that I can "declaratively render the updated page on the server"? My understanding is that an action can just revalidate or redirect or reload, it doesnt arbitrarily change something in the DOM on the page? If I were to revalidate, redirect, or reload, then what does it matter if I return the Error? Isnt the important part the fact that I either revalidated, redirected, or reloaded?
8 replies
The combination of API routes and data loading functions
yeah, something like that is what I have been looking into (and also an error handler/catcher)
the nice thing about API Routes, even if you double call, is that 1 request equates to 1 function which is 1 log
but in the case of cache server functions and SSR and revalidations, the former could be the case, but ALSO you can have 1 request equate to multiple functions for 1 log
52 replies