-
Notifications
You must be signed in to change notification settings - Fork 241
Loading #115
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
Loading #115
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Deleting files is already possible. It's not that pretty, but if you create a folder with the file |
What do you think about requiring |
I think it would create more work, there are not that many tutorials that need deleting of files, most are additive. But I noticed that it's sometimes hard to keep track of what the finished app looks like, keeping content from app-a in your head, so it's probably a worthwhile change regardless - if we didn't implement most of this already 😅 so maybe in a cleanup PR afterwards |
Yeah, was just commenting that I do quite like the fact that changes to files in What if instead of |
I'm fine either way |
Ah, I see — |
Co-authored-by: Rich Harris <hello@rich-harris.dev>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
I see that you added notes on |
<div>{@html data.post.content}</div>+++ | ||
``` | ||
|
||
There's one last detail we need to take care of — the user might visit an invalid pathname like `/blog/nope`, in which case we'd like to respond with a 404 page: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this part of the tutorial? If we just gloss over this for now, almost noone would notice, and it's one less thing to worry about for now. Furthermore, this is pretty much all there is to explain about expected errors, so the later section where this is explained would feel rather duplicative.
(would also give room to add that "notice how we can colocate stuff" info box I wrote previously, which I thought is a nice argument in favor of our +convention)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good to me - great work! This feels a lot more fleshed out now. Left a few small comments, and one on the $types
situation, which I think we should solve by leaving this out of the tutorial for now.
Another idea for solving the hacker news thing would be to create a similar convention to __delete
: if there's a __hidden
file inside a folder, that folder and all its contents don't appear in the file tree. That way, we can say that there's some external API at api/blog
or sth like that. It has the added benefit of being able to reuse the same blog contents and being more reliable (also, the outgoing links don't work). I'll try that in a separate commit, which we can revert if you don't like it.
content/tutorial/02-sveltekit/02-routing/07-api-routes/README.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* start of routing tutorial * more chapters * slots * chapter skeletons * mutating data section * Apply suggestions from code review Co-authored-by: Tan Li Hau <tanhauhau@users.noreply.github.com> * errors and redirects chapter * invalidation chapter * render options section * add missing meta.json files * advanced routing wip * fix link * matching, groups * use new capabilities to adjust tutorials * remove duplicate layout from page * more sections * tweaks * remove log * disable csrf for tutorial * more content * fix interval * leverage adding files functionality for error tutorial * simplify * tweak tutorials so people have to create the files * tweaks * tweaks and fixes * Update content/tutorial/02-sveltekit/03-mutating-data/04-progressive-enhancement/README.md Co-authored-by: Geoff Rich <4992896+geoffrich@users.noreply.github.com> * switch example, because alert will prevent the ping events, resulting in an endless alert loop because of constant iframe reloads * labels for inputs * tweaks and fixes * fix * environment variables tutorial * fixes * Update content/tutorial/02-sveltekit/01-concepts/03-server-and-client/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/01-concepts/03-server-and-client/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/01-concepts/04-server-side-rendering/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/01-concepts/04-server-side-rendering/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/01-concepts/05-prerendering/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/01-concepts/05-prerendering/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/01-concepts/05-prerendering/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/02-layouts/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/02-layouts/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/02-layouts/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/02-layouts/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/02-layouts/app-a/src/routes/+page.svelte Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/02-layouts/app-a/src/routes/about/+page.svelte Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/02-layouts/app-b/src/routes/+layout.svelte Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/03-loading-data/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/04-loading-layout-data/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/02-routing/07-params/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/03-mutating-data/02-form-validation/app-b/src/routes/+page.server.js Co-authored-by: Rich Harris <hello@rich-harris.dev> * lowercase Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/06-rendering-options/02-ssr/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/02-sveltekit/06-rendering-options/03-csr/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/04-advanced-sveltekit/01-advanced-routing/01-optional-params/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/04-advanced-sveltekit/01-advanced-routing/02-rest-params/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/04-advanced-sveltekit/01-advanced-routing/03-param-matchers/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * Update content/tutorial/04-advanced-sveltekit/01-advanced-routing/04-layout-groups/README.md Co-authored-by: Rich Harris <hello@rich-harris.dev> * move explanatory content from concepts into render options chapter * remove backticks * Update content/tutorial/02-sveltekit/02-routing/05-loading-server-data/README.md Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> * Update content/tutorial/02-sveltekit/02-routing/03-loading-data/README.md * Loading (#115) * shuffle sections around * update error page * update params section * rename * update some content * HN example * update API route docs * fix script * tweaks * typo * fixes * fix * tweaks * use __delete * add some css * allow files to be marked for deletion * [chore] bump deps * [chore] robustify create-middleware Co-authored-by: Rich Harris <hello@rich-harris.dev> * [chore] handle offline case in +error.svelte Co-authored-by: Rich Harris <hello@rich-harris.dev> * [fix] style "/// file: .." pragmas in code blocks Co-authored-by: Rich Harris <hello@rich-harris.dev> * [feat] __delete inside file means delete that file Co-authored-by: Rich Harris <hello@rich-harris.dev> * next * fix lockfile * tweaks * [feat] __hidden file to mark folders as hidden * use hidden API instead * Update content/tutorial/02-sveltekit/02-routing/07-api-routes/README.md Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com> Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> * fix casing * note configurability * remove mention of vite * fix solve button styles * only add data-file attribute to files * separate routing and loading into separate sections, etc * remove $types, for now * move stuff * use a todo list example - better showcases PE, avoids complexity around user/session management * swap exercise order * flesh out form examples * move invalidation to advanced section * tweak page options docs * move * flesh out example to show use of page store etc * small tweaks * better redirects tutorial * move $page.X usage into second chapter * await parent * tweaks * better private env tutorials * get rid of VITE_ prefix * fix gitignore * remove logging * fix * fixes * invalid -> fail * robustify * rename section to the less-ambiguous "exercise" for my own sanity * allow an exercise to inherit files from previous exercises to reduce duplication * remove some now-unnecessary files * delete file * hide error customisation exercise for now - not ready to talk about hooks * update errors and redirects section * more detail * tweaks * add inspector * formatting * make "next" links more sensible * fix chaining logic * update optional params example * rest params example * different param matcher example * tidy up * move some content around * add placeholder chapters on hooks and stores * env var stuff * oops, didnt mean to add these * tweak * style tweaks * move filetree components to separate folder to ease future refactoring * tweaks * remove warning spiel * update deps * use a regex * Revert "use a regex" This reverts commit ac9f872. * try this instead * use +layout.server.js instead of tutorial.json * make typescript a bit less complainy * show current exercise in menu * refactor filetree stuff a bit * remove unused import * simplify file creation, always select newly created file * move icons * oops * derive depth at point of use * simplify renaming * simplify * refactor filetree * remove unused import * make editing constraints visible - is more accessible etc * use a store for filesystem state * make constraints more granular * DRY things out a bit * more DRYing out * insertion order * various fixes * a11y fix * fix * context menu styling * fixes * DRY out actions * fix * fix * fix * DRY out some more * refactor * split up env var exercises * fix * put <img> inside <button> * remove some unnecessary files * add route group example that includes a load function * shuffle things around a bit * make breakout example more visual * oops * bump kit * add way to relax file tree constraints * fix complete/reset state toggle * pretty sure we actually want to check in the lockfile * tweak * remove TODO * tweak example * demonstrate returning non-serializable data from load function * rename exercise to invalidation * show a case where one load is invalidated and one isnt * follow previous exercise, use generic data:blah key * follow previous exercise * add coming soon messages to get us off the hook for now * remove old TODO * work around hotlinking limitation * remove __hidden mechanism, its way too confusing. comment out this exercise until we can investigate truncated bodies * add some default styles etc * more tidying up * explain CSRF stuff Co-authored-by: Tan Li Hau <tanhauhau@users.noreply.github.com> Co-authored-by: Geoff Rich <4992896+geoffrich@users.noreply.github.com> Co-authored-by: Rich Harris <hello@rich-harris.dev> Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
This updates the loading section per https://github.com/sveltejs/learn.svelte.dev/pull/105/files#r1038350603.
Couple of things to note:
/// file: some-file-name.js
convention from the Kit docs, but there's no CSS in place for that just yet, so it looks a bit funkyevent.fetch(...)
call in the Hacker News example doesn't work, because the response is truncated. I can only assume this is a problem with WebContainers somehow, but I haven't investigated yetapp-b
was assumed to be additive, but in reality there are times whenapp-a
contains files that shouldn't exist when the exercise is solvedI think it's probably worth merging the content into
tutorial-routing
and worrying about the functionality later