Rich Harris - Annoying Things About Svelte

Поделиться
HTML-код
  • Опубликовано: 30 июн 2022
  • Platinum Sponsor:
    Monogram - monogram.io
    GraphCMS - bit.ly/3Ft8ojy
    Vercel - vercel.com
    Gold Sponsors:
    Storyblok - bit.ly/3OuJEg4
    Array - array.com/company/about-us
    JavaScriptDB - javascriptdb.com/?ctx=svelte-...
    Netlify - netlify.com/
    Music By:
    Fractal - / officialfractal
    Description:
    Things we did that svelte users are annoyed about
  • НаукаНаука

Комментарии • 126

  • @skryonline5825
    @skryonline5825 2 года назад +201

    This guy is just awesome. Very professional. I would love to see him every month talking about the progress on Sveltekit 1.0, what issues as developer they encounter and how can we help them as a community. Thak you, Rich

    • @justinoneill2837
      @justinoneill2837 2 года назад +1

      I second that

    • @look997
      @look997 2 года назад +3

      Just go to issues in the repo Svelte Kit.

  • @mendodev8775
    @mendodev8775 2 года назад +107

    This guy is a genius! I loved the part where he analyses the {#switch} template and thinks on the best way to deliver the feature for a syntax that doesn't even exist. It's easy to understand why svelte is the most loved framework now that i've seen his thought process in action.

    • @derzw3rg
      @derzw3rg 2 года назад +6

      That really impressed me a lot as well. Great talk and I like his way of finding solutions of problems.

  • @adamghowiba
    @adamghowiba 2 года назад +57

    Rich is truly one of the best things that could have happened to the web development community. His outlook on dealing with problems is one of a kind. His way of dealing with criticism, and how he addresses his user base is so professional & refreshing to see.

  • @PreRenderedRealities
    @PreRenderedRealities 2 года назад +61

    Honesty, professionalism, and a total lack of pretentiousness. Thanks Rich and the entire Svelte/Kit team, I'm glad I am betting on Svelte for my own projects.

  • @hiagooliveira6510
    @hiagooliveira6510 2 года назад +112

    I like the Switch implementation, except for making the default case the first thing after opening the switch block. It makes it look like it will be always run regardless, and then deppending on the case something else is ALSO executed.
    I would prefer to still have a default block

    • @ch1caum
      @ch1caum 2 года назад +5

      Agreed, also on the default case.

    • @clintquasar
      @clintquasar 2 года назад +12

      I would rather have the default moved to the end of the switch block without its own block, that seems clearer to me as if no case is a match this is what you get.

    • @kurtesimo
      @kurtesimo 2 года назад +1

      Agree with above statement!
      Love the idea of a switch implementation!

    • @risavkarna
      @risavkarna 2 года назад +4

      Also needs some thoughts on how to allow for fall through multiple cases without assuming a 'break' in each case and how to accommodate more complex case selectors/predicates.

    • @natfailsyoutube8163
      @natfailsyoutube8163 2 года назад

      Having the default first also seems a strange inversion to me, as it's so tied to not matching all the other cases and handling what remains as a kind of final thought

  • @mishuhishu94
    @mishuhishu94 2 года назад +14

    switch seemed nice but since default case is always at the bottom I feel it would make more sense to leave it there to avoid confusion

  • @nikfp
    @nikfp 2 года назад +15

    The walkthrough on providing good reproductions seemed remedial, but I actually enjoyed it quite a bit and it was good to see it from the view of the maintainer. I'll certainly be much more attentive in the future when creating issues. Thanks Rich, "Be like Bluebie!"

  • @shmert
    @shmert 2 года назад +8

    -1 to switch, doesn't add enough benefit to justify the new syntax, and is more LOC than if/else. Really great, personable vibe from the video overall. Signed, a minimalist.

  • @dealloc
    @dealloc 2 года назад +10

    Instead of switch, I would prefer if it was using pattern matching ala. Rust and the JavaScript pattern matching proposal. This would make it much easier to include special conditions without having to refactor switch to if/else.

    • @apmcx
      @apmcx 2 года назад

      I agree. I often file myself switching on a string, and occasionally a case ends up needing to be a regex match and refactoring to if/else is a pain

  • @hoelldrio5881
    @hoelldrio5881 2 года назад +5

    I don't use switch that much. But your pseudo code for switch looks beautiful and convinced me ;) was great to read

  • @stefan.astrand
    @stefan.astrand Год назад

    Love the switch. I know it’s usually frown upon but it keeps the code so much cleaner.

  • @raph151515
    @raph151515 Год назад

    as an alternative to the current control flow syntax, we could be using html elements(separate from the content, not like Angular). The nice thing about that is that normal HTML tooling can work with it. the dev mode could even use web-components to implement them on the client side

  • @soviut303
    @soviut303 2 года назад +4

    Switch statements feel mostly redundant; I was half expecting you to say "this switch statement I crafted looks a lot like an if/else". I've found the majority of my template logic is if/else blocks; very rarely do I need an else-if (I'd even consider it a bit of a code smell when I do).

  • @craigmcinnes1212
    @craigmcinnes1212 2 года назад +3

    still not got around to using svelte in anger yet, but still sat through this entire video as I love my svelte fix and Rich is just such a great guy. I learns lots from the vid about web dev in general and how to raise good bugs which would apply to any repo. Thanks Rich.

  • @Shaparder
    @Shaparder 2 года назад

    These talks are just great, learn so much watching them.

  • @KiLVaiDeN
    @KiLVaiDeN Год назад +1

    Loved the analysis of the #switch template, I would keep the {:default} part of it because it's more self explanatory, though having the default part of the switch on the beginning of the switch block with no tag doesn't feel natural (people might wonder if it's gonna be always active or not), and also it's not consistent with existing switch constructs.

  • @stavrosfarmakis5052
    @stavrosfarmakis5052 2 года назад

    Internet : what we find annoying about svelte
    Rich : And Rohan will answer

  • @RobGregory
    @RobGregory 2 года назад

    Yes please on the 'Switch case' your final example looks fine and consistent.

  • @TurtleFul
    @TurtleFul 9 месяцев назад

    I thought I would not like the switch statement... and then you typed it out and I realized that it would be sooo nice to have.

  • @A.D.G
    @A.D.G 2 года назад +1

    My issue with the switch syntax is not knowing how you’d do case fallthrough (no break statement). It’s a handy thing to have in some (excuse the pun) cases

  • @mavdotj
    @mavdotj 2 года назад +3

    the vscode argument is completely valid, sometimes i try to import svelte transitions and it imports "svelte/types/runtime/[...otherStuff]"

    • @willsterjohnson
      @willsterjohnson Год назад

      I've found that the builtin JS, TS, and JS/TS settings to VSCode are the problem. I can't recall what they are but relating to imports, the specifier should be set to "shortest" I think

    • @yestermonth
      @yestermonth Год назад

      That module decimates my work

  • @patrykstaniewski
    @patrykstaniewski 2 года назад +9

    +1 for adding {#switch} {:case}

  • @ajb7753
    @ajb7753 Год назад

    Big into the Switch syntax! Looks lovely...

  • @uquantum
    @uquantum Год назад

    Loved this vid, thanks so much! You may even get more views if you go all out and add to the title.."and things you lot do that annoy us!" I for one promise to take my shoes off and be more like BlueBie...provide a simple fresh repro each time we raise an issue. To continue the shoe metaphor, that we put ourselves in the maintainers shoes as much as possible even using standard norms (npm instead of yarn or pnpm). I wonder how many of us had thought of that!

  • @ChaoticNeutralMatt
    @ChaoticNeutralMatt Год назад

    Very interesting think-out with case. I think what you came up with would be a fairly good feeling use.

  • @vivsh.1999
    @vivsh.1999 Год назад +1

    Switch case is good in case of fall through, its a good to have feature but do consider breaks and default case properly.

  • @teeodoubled3000
    @teeodoubled3000 2 года назад +3

    +1 for adding switch

  • @chrsbll
    @chrsbll 2 года назад

    My only question regarding the switch block is: how would you account for the presence/absence of the break commands - it's arguably rare, but sometimes you don't just want to run the code for a single case.

  • @JLarky
    @JLarky 2 года назад +1

    12:31 you should really take a note from the "astro add" command, it allows you to do all of those changes for an already existing project.

  • @JoshWithoutLeave
    @JoshWithoutLeave Год назад

    I would really love to see some but in image processing similar to Next/Image or even the new one they’re playing with Next/Future/Image

  • @IStMl
    @IStMl Год назад

    10:48 Im not sure, because the default is what is executed/returned if no other case applied. So intuitively it should be after all defined cases.

  • @coderlicious6565
    @coderlicious6565 Год назад +1

    I'm going to use Svelte rewrite a web-based app I wrote in 2018 with React originally, which is just a mess - it needs an upgrade, but a bunch of plugins just break when I try.
    It will be a fresh new, fun rebuild of the UI on top of my php back end.

  • @sumitman4281
    @sumitman4281 Год назад

    For the switch block for the syntax that you displayed how will we enable case fall through .. eg: case 1:case 2: both run 1 block

  • @Ilya60623
    @Ilya60623 Год назад

    The switch statement is great. Would love to use Svelte Native for my next production app.

  • @DavidAlsh
    @DavidAlsh 2 года назад +1

    Does svelte support split file components? Single file components are cool but splitting things up makes it easier for me to do things like testing

  • @starlederer
    @starlederer Год назад +1

    I hate the fact that there is no good way to customize Svelte components with CSS. I used React + CSS in JS once and loved being able to easily customize components with custom classes. I used that for width, height, margins and other things that the component itself should never define.
    Workarounds (and why they don't work):
    * Use flexbox/grid (this is limited to size and margins but sometimes you need other CSS customization)
    * Pass class as string (Only works for global CSS and is not compatible with atomic CSS)
    * Pass inline CSS as string (Unreadable code + no IDE support + code can't be optimized + no CSS pre/postprocess + not compatible with atomic CSS)
    * Use a CSS in JS solution (Solves most problems and has great DX but introduces runtime overhead. In my future projects I might just go with this method)
    I wish Svelte just detected if an exported variable is being used as a class and treated it as if it was a class attribute of a regular dom element

  • @sherifsalah5563
    @sherifsalah5563 2 года назад

    I really wish we could have a switch block, i needed to use it a lot of times before but sadly resorted to if else, its a great syntactic sugar

    • @abhaynath5833
      @abhaynath5833 Год назад

      Did you tried using ?
      It helped me reducing #if else.

  • @jaykhan_sound
    @jaykhan_sound Год назад

    love sveltekit so far! Feels so much more productive and it's still in beta.

  • @CrzyMan_Personal
    @CrzyMan_Personal 2 года назад

    While SSR vs SPA is a good argument for SSR, I was initially thinking the comment had to do with SSR vs Static. I recently ran into an issue where I was trying to generate a non-routed and non-hydrated prerendered site. However, I had some JS on the page to manage some fun animations. Unfortunately, not hydrating meant that NO js was on the page. Which resulted in no animations. Which isn't at all what I was hoping it would do.

  • @venir_dev
    @venir_dev 2 года назад +1

    Rich, I'd suggest to think about integrating the "Island Architecture" into SvelteKit somewhere in the near future (v2.0 maybe?)

  • @ScottMackey
    @ScottMackey 2 года назад +4

    The fact that Rich will sit there, show his thought process and do some coding with us, is delightful. Love Svelte, wish I would have been able to talk my old company in to using it. My future projects will all be svelte. Keep up the great work!

    • @IStMl
      @IStMl Год назад

      he open-sourced his thought process

  • @DanielRios549
    @DanielRios549 2 года назад +4

    11:18 I really apreciate this switch syntax, you write less code when the else ifs get bigger, no need to repeat the variable for example

  • @UzairSAhmed
    @UzairSAhmed Год назад

    I am a big fan of the switch case and was thrilled when python added that functionality. My vote would be to have a {#switch} block for Svelte!

  • @IBMboy
    @IBMboy 2 года назад +2

    switch case syntax is a game changer. i can feel it

  • @elmotareal
    @elmotareal Год назад

    Hmmm, can't believe no one mentioned this but layouts don't have end points! That's like a show stopper sometimes

  • @altairbueno5637
    @altairbueno5637 2 года назад

    Oh god please that switch statement is just what we need

  • @rand0mtv660
    @rand0mtv660 2 года назад +1

    Thanks for highlighting that people opening issues should put some effort into it. I'm not an OSS maintainer, but I've ran into many issues in different repos where people didn't even bother posting the error message that they got, let alone create something more detailed and robust.
    Worst offenders seems to be people that don't even google the problem that they have, because if they did they would immediately see an older StackOverflow/GitHub thread with a solution posted...But no, they just decided to open a new issue and go about their day.
    As far as I'm concerned, you should become more strict and just close issues that are super low effort. If people don't have the basic decency to treat you (and the project) with a certain amount of respect, I don't know why you as maintainer of something should burn out because of others.

  • @tanglesite4461
    @tanglesite4461 Год назад

    As always it is a joy to listen to RIch, you should totally have a Pod Cast. Great video. One day maybe Svelte will rule the world.

  • @fernwood
    @fernwood 2 года назад

    I’d recommend self-documenting the config file with commented-out directives.

  • @pikapomelo
    @pikapomelo 2 года назад

    Issues are helpful for not just maintainers. I haven't used svelte yet, but I have plenty of other open source software and issues even closed ones are often the only sanity check or opportunity to find work arounds.
    I get that maintainers want nice issues, but that is often a large burden on users and does have a negative impact on community contributions.
    Maybe the trade offs are acceptable.

  • @phxf
    @phxf 2 года назад

    Aw what a pleasant surprise! Thanks man!

  • @TannerBarcelos
    @TannerBarcelos Год назад

    All my projects outside of work, here on out, will mostly be in Svelte/kit with some React/Next to stay fresh for work / my day job that uses react whenever I contribute to some client side codebases (and of course, interviews since it’s still dominating the market). I just feel like Svelte, especially with how Vercel feels about it and how they brought Rich aboard, is about to really take a step up in popularity and usage. I think it has better marketing than Vue, and better content online. Once it gets a larger community following, it should dominate and be on reacts level of popularity.

  • @dutchharry4420
    @dutchharry4420 7 месяцев назад

    i like the {#switch} syntax :-)

  • @buddymiles7210
    @buddymiles7210 Год назад

    Thanks Rich Harris, loving Svelte

  • @m12652
    @m12652 2 года назад

    Think I probably missed something in the documentation, but… given everything is an object in javascript I pass functions to components as props instead of using create event dispatcher as it seems (is) less complicated. So, maybe if passing functions is fine then the more long winded approach using event dispatcher is annoying.

    • @m12652
      @m12652 Год назад

      @@kieranbarker1902 Indeed… and since posting I stopped passing in functions generally in favour of a simple on:click and let the parent handle the click inline with the markup. Or I use set context.

  • @Mitsunee_
    @Mitsunee_ Год назад

    while I like the rant on reproduction repos vs a branch of a real project I've had multiple instances where I couldn't recreate a bug outside of my own project with the exact same lockfile. I still don't quite know what's wrong there, I even turned my branch into a draft PR so I could trigger my CI and the error does occur in github actions, but I cannot recreate it outside of that project.

  • @bugs181
    @bugs181 Год назад

    @11:25 yes please! Switch blocks, please!

  • @viniciusataidedealbuquerqu2837
    @viniciusataidedealbuquerqu2837 2 года назад

    starting song is catchy asf holy shit

  • @ransomecode
    @ransomecode Год назад

    Please no switch statement; as something for the future consider match statement, to enable pattern matching

  • @classicguy7813
    @classicguy7813 2 года назад

    Thanks Dear Mister Svelte-president

  • @hglbrg
    @hglbrg Год назад

    I'm late to the party but switch statements are beautiful in Kotlin using the `when` functionality. Used to hate them in PHP so avoided them altogether in JS/TS - regardless how clunky it got.

  • @Troy-ol5fk
    @Troy-ol5fk 2 года назад

    Please ship the {#switch} syntax, it looks so nice

  • @raph151515
    @raph151515 Год назад

    js switches are simpler then if else because they only represent onet side of a comparison but they are limited by design because of this. If elses take a condition expression which is more flexible/complete. I see why seeing a long if else can make you wonder if switches are better but by seeing Rich's exploration I understand why it wouldn't be that beneficial. mapping values to dom expressions could be useful but in svelte, I don't think that I've seen a way to create "DOM expressions", the only way I would know now is but it requires real module components. Yes, the switch syntax you tried out is nice.

  • @nephis_2006
    @nephis_2006 Год назад

    i love this man

  • @JLarky
    @JLarky 2 года назад +1

    Starts at 0:50

  • @rizandev
    @rizandev 2 года назад

    Very insightful, +1 for switch implementation.

  • @jakob7116
    @jakob7116 2 года назад

    I’m sure I’ve seen this a few months ago but this video was published 4 days ago???

    • @SvelteSociety
      @SvelteSociety  2 года назад

      It was part of the Svelte Summit Spring 2021 Conference which was posted online in one very long video.

  • @LukePuplett
    @LukePuplett Год назад +1

    13:38 teach me to fish 👍🏼

  • @SRG-Learn-Code
    @SRG-Learn-Code 2 года назад +1

    Is this a reupload? I swear I've seen this already.

    • @SvelteSociety
      @SvelteSociety  2 года назад

      It's from the last Svelte Summit, you probably watched it live, or the full conference video. :)

  • @paritoshmalhotra6309
    @paritoshmalhotra6309 2 года назад +1

    The first switch syntax, with cases indented and default at the end is the easiest to understand and most similar to other languages, that would be ideal!

  • @nomadshiba
    @nomadshiba 2 года назад

    bind:attributes
    so i can stop abusing display: contents

  • @josephs3973
    @josephs3973 Год назад

    Thank you, Jesus.

  • @IStMl
    @IStMl Год назад

    16:29 I saw chakra and mui for svelte

  • @trigunadi4024
    @trigunadi4024 10 месяцев назад

    i'm just here waiting for someone to mention Rich Harris as the Jesus of Web Development

  • @dev_geometryse4267
    @dev_geometryse4267 2 года назад

    WE NEED SWITCH BLOCK

  • @xmine08
    @xmine08 2 года назад

    Not a big thing but I think the colon-prefix is superflouos. Instead of {#if ..} {:else} .. {/if} why not simply have {#if ..} {#else} {/if} ? I think the slash, akin to the HTML/XML 'end', is clever and nice to read. However, I don't see much that speaks for having the colon prefix, thus only adding more to learn.

    • @xmine08
      @xmine08 2 года назад

      Apart from lil' pet peeves, Rich you're a real asset to WebDev. Svelte is the first Web Framework that is a joy to use, everything else is just doing things in a complex manner because "What we're doing is complex, durr". Especially Angular falls into this hole. Thank You!

  • @emberchord
    @emberchord 2 года назад

    He really made a “reacting to my subreddit” video in talk form.

  • @hazreh
    @hazreh 2 года назад

    isn't this a reupload?

  • @mehmetakyuz5290
    @mehmetakyuz5290 Год назад

    Annoying things about Svelte = being too good

  • @chientrm
    @chientrm 2 года назад

    Glory hair and nice beard

  • @westonbarnes8120
    @westonbarnes8120 2 года назад

    Yes, please on the {#switch} ! Thanks for all you work!

  • @101kawsar
    @101kawsar Год назад

    CaptainAmerica0001 is me 😳

  • @jacobroling2287
    @jacobroling2287 2 года назад

    Yes please add that switch implementation that actually looks pretty clean

  • @thejaredwilcurt
    @thejaredwilcurt 2 года назад

    "Syntax is the thing people ask us to change most".... maybe it's because, even ignoring personal preferences, the Svelte syntax is just... ya know.... really ugly?
    Vue's done the best job out of everyone by being completely unopinionated. It has a default approach, but if you want to use a more Svelte or Hooks-like style or Classes or OOP, or functional, or JSX, or Markdown, or CoffeeScript or TypeScript, ...you can. It just lets you do anything. Yes I think most of these are terrible, but somebody out there is using them because syntax matters. Svelte's default syntax being so ugly and there being no option to change it has warded off most people I've talked to from using it. Or even trying it for more than a minute or two. It doesn't matter what features you offer, if to get them I need to look at something ugly the whole time.
    I see this as Svelte's biggest downfall, it's like the focus is 99% on performance and anything that isn't perfomance has to fight for attention in the 1% of efforts. Developer experience should be Svelte's primary focus for probably the next 2 years. Maybe I like having seatbelts and air conditioning more than having a marginally higher top speed.

  • @MattSkinner_mdskinner
    @MattSkinner_mdskinner 2 года назад

    Switch 👍

  • @JLarky
    @JLarky 2 года назад

    22:53 how to provide reproduction steps for an issue

  • @mavdotj
    @mavdotj 2 года назад

    {#switch value}
    value is equal to {value}
    {:case 0}
    Empty...
    {:case 69}
    Nice
    {/switch}
    insert some kind of counter element

  • @jpgarcia90
    @jpgarcia90 2 года назад +1

    rich you're a fucking boss

  • @Dimich1993
    @Dimich1993 2 года назад +1

    Thanks for supporting Ukraine guys!

  • @user-tb6vx9tl5q
    @user-tb6vx9tl5q Год назад

    I am just here to say that I LOVE SVELTE!!

  • @VAcharya
    @VAcharya 2 года назад

    Can we start using svelte kit in production ? Why 1.0 delaying ? What’s up with this vite issue that blocking ? Can anyone throw some light !!?

    • @__jan
      @__jan 2 года назад

      You can if you can allocate effort towards updating it very often. If not, be patient :)

    • @hazreh
      @hazreh 2 года назад +4

      I'm using Sveltekit in production and it works very well, there has been only few small breaking changes, that usually just name changes, except for endpoints which is completely new thing but you don't have to use them.

    • @look997
      @look997 2 года назад +1

      @@hazreh Just go to issues in the repo Svelte Kit.
      You have "SvelteKit 1.0 release blockers in Vite" and "Help getting to 1.0" pinned there, which show what's missing for version 1.0.

  • @pickavana8056
    @pickavana8056 Год назад

    Annoying things about Sveltekit - its NOT Svelte-like, at all. If svelte was like sveltekit, few if any would use it.

  • @valen8560
    @valen8560 2 года назад

    I'd like this for the switch
    {:switch thing}
    {:'foo'}
    {:'bar'}
    {/break}
    {:'foo1' | 'bar2'}
    {/break}
    {/switch}
    following the c style switch because it allows falling through

  • @-ion
    @-ion 2 года назад

    _too lazy for one commit at a time_

  • @PiyushChauhan2011
    @PiyushChauhan2011 2 года назад

    I saw Jesus today

  • @AshleyPOliver
    @AshleyPOliver 2 года назад

    The MOST annoying thing is that music ...

  • @botyironcastle
    @botyironcastle Год назад

    vs code extension sucks
    :(

  • @metazebre
    @metazebre Год назад

    This {#switch} stuff is just syntax sugar over {:else if }. It does not make the code simpler and won't bring any value. In the same team, some coders will use {:else if}, others {#switch} for no particular reason apart from personal feelings ... sometimes, it's better to have just one good solution to rule them all.
    IMHO, don't bother implementing {#switch}

  • @willsterjohnson
    @willsterjohnson Год назад

    10:39 I designed exactly this switch/case a year ago with a preprocessor, it would compile down to if/else.
    I deleted the project but forgot to deprecate the NPM package, @willsterjohnson/wutils

    • @willsterjohnson
      @willsterjohnson Год назад

      the docs for it are gone along with the repo, and I can't remember how to set it up... but the dist code is there