-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove network calls from demo app #4264
Comments
Even without the speed concerns, I'd be in favor of a tiny ad-hoc in-memory data store thing for the todo app rather than calling out to the Cloudflare KV API. |
I'm wondering if it's an issue with the API being served from somewhere in North America and certain users on other continents experiencing unusually slow network performance? I also think some sort of in-memory data store would provide a better/more consistent user experience as long as it's still able to demonstrate the same functionality that is shown with the current setup. Specifically things like utilizing fetch, handling redirects, method overrides, etc... Having a demo that interacts with an external API is very useful as most people will need to do the same, and showing some best practices helps them get started on the right foot. An update here could also be an opportunity to add functionality demonstrating shadow endpoints (unless that would create too much confusion for new users). |
Semi-related issue here: #4225. Certainly not averse to overhauling the demo app. The trouble is we're forced to choose between two options:
I'm a little uncomfortable with the idea of a demo app that stops working the minute you deploy it. Which leaves option 3 — don't demonstrate persistence and dynamic SSR — but then we're failing to demo a significant aspect of SvelteKit's functionality. |
IMO... By default, the Demo app will use an in-memory object. |
I was thinking using something like json-server could provide a good middle-ground, where a full rest api could be utilized but the backend is running in the same environment as the frontend. To me, persisting data between a local dev environment and a deployed environment isn't that important, considering in most real-world scenarios you wouldn't want that either. The main downside I can see of using something like |
I prefer the app to send these requests, it is closer to reality. We need a more friendly interactive experience. |
To be clear, the issue isn't persisting data between local and deployed, it's having a backend that works both locally and deployed |
I may not be getting it correctly, but #4266 stores data for each user, so there is no data conflict even if multiple people connect to the deployed app. The only issue is losing all data when the app is deployed. |
If the confusion is around the loading speed difference between static pages and the TODOs page, perhaps a simpler solution would be to just add some
|
I see the recent skeleton is using https://api.svelte.dev .. My browser offered up some autocomplete data and because I had not reviewed all the skeleton code first (trying it out so to speak) I was surprised to see only local calls in the browser's console but 3 local calls taking almost a second each. The autocomplete entries added from the browser and confusion poses a small security risk. Also, I was wondering if there was a bug in the update and rendering but I found this issue which clarified everything. Maybe add an checkbox to use the remote API or not so it is easy to verify the feel of a the local only API calls and with a store when unchecked. And of course a loading indicator. |
Could we imagine providing both experiences with an environment variable switch? const base = localDev ? 'http://localhost:3000/api/local_api_svelte_dev' : 'https://api.svelte.dev'; And implement After, the question is: Is it a realistic demo? |
Something else I've just realised: for whatever reason, the todos page doesn't work on StackBlitz (https://sveltekit.new). Unclear whether it's a fixable bug or an inherent limitation, but could turn out to be another good reason to change the demo |
Yes, In a demo remote fetch is nice to showcase imo. But maybe only reading data is sufficient? I'll be happy to help, let me know how. |
Here's a screen recording showing the janky behavior you get when clicking on the It freezes the ui for a short second giving a rather janky first impression of sveltekit. Screen.Recording.2022-06-30.at.15.31.44.movAs I understand it, this is because sveltekit waits for a request to finish before doing the transition to the todos page. Is there a way to make the transition happen before the request has a response and then show a loading indication on the page until it does? |
OK, so I've tried investigating this a bit further to see if I can find a path forward here. Rich's comment here gives me the understanding that the point of the todos page is to demonstrate Neither of these two requirements make the ui freeze when clicking todos necessary as far as I can tell. When clicking todos we are doing client side rendering and not SSR, right? So waiting for SSR should not be a limitation. I see no reason why the ui couldn't do the page transition even if the server is doing some async fetching of persisted data before returning a response. After the page transition we could just use the In theory this makes sense to me. But as far as I can tell Sveltekit endpoints are based on load functions which are implemented such that they always block rendering when they are async. |
In SSR I think it makes sense to block, but in client-side navigation, it makes less sense (you can fill a store that will update when it will update). So depending on cases (client-side navigation or SSR), I trick the effect of You can check #4447 for some more detail. |
How about just displaying the latency / response time after each submit below the submit form? Or some status updates about what the request is doing? |
Describe the bug
I have seen so many people complaining that SvelteKit is slow. No one realizes that a locally created demo app would be making network calls.
E.g. https://discord.com/channels/457912077277855764/939868205869072444/950313663850508328
This would also solve our issues around eventual consistency: #1564
Reproduction
I don't know if these people have particularly slow network connections or the app or host is sometimes being quite slow
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: