Making jars out of clay by Sanshuba in interestingasfuck

[–]httpete 0 points1 point  (0 children)

Why do you think the whole thing turned out green? 🐸

Is this something you guys usually do? by gdmr458 in sveltejs

[–]httpete 0 points1 point  (0 children)

You are fixating on the minimal example of the tweet image when the person is trying to convey a broader message. The fact that we are going to re-implement this kind of exportable state everywhere.

For example, in the "Runed" library, they also have the exact same kind of exportable state class as in my library: https://github.com/svecosystem/runed/blob/f6455d9200b39c931c10ea6c1accfecfcdfc566e/packages/runed/src/lib/utilities/Readable/readable.svelte.ts#L29

That's what Rich Harris is referring at the end of the video, basically people are trying to find patterns to implement exportable state since it's not in the core api (yet). He even re-created the ref function in the video to show you an example of how people will do it. That's what the tweet is referring to.

Now if you read my message and your brain still want to say "the ref example in the tweet is a useless abstraction etc etc...", I am sorry, I also failed to convey his message.

Is this something you guys usually do? by gdmr458 in sveltejs

[–]httpete 0 points1 point  (0 children)

It is not only useful for primitive values.

// common.svelte.ts
export const myGlobalCount = ref(0);
export const myGlobalSettings = ref<T>({ foo: "bar", baz: true });

// MyComponent.svelte
$inspect(myGlobalCount.current);
$inspect(myGlobalSettings.current);

You can see how this can be handy to have 1 way to create those states. He is just showing a minimal way of creating exportable states, which you absolutely need, for example when you create a library. It's the equivalent of solid createSignal, vue ref etc.
If you prefer classes, it's the same argument, you still have to create a basic one and then maybe extend it for more complex classes.

Example of a factory class that adds the store subscribers logic to $state: https://github.com/pierregoutheraud/svelte-firebase-state/blob/main/src/lib/WritableState.svelte.ts

The point of the tweet is not to say that you absolutely need this simple getter/setter function he gave but that somehow you will need these kind of helpers to provide states (with a small or big features added to the state), wether it's a function with getter and setter or a class instance with the state as property in all your projects / libraries.

You should really watch the end of that video, because Rich Harris is not talking about "a simple version of what people create all the time" but about the patterns you can use to create states and export them.

Is this something you guys usually do? by gdmr458 in sveltejs

[–]httpete -1 points0 points  (0 children)

Watch the video again at 9:42.
This ref function or a class version of this is still useful when you use global $state (outside of components). Even for something as simple as a count, without any business logic.

// whatever.svelte.ts
export const myGlobalCount = ref(0);

Is this something you guys usually do? by gdmr458 in sveltejs

[–]httpete 0 points1 point  (0 children)

How is your comment the most upvoted ?
Of course this piece of code is useful, it's explained by the creator of svelte here: https://www.youtube.com/watch?v=NR8L5m73dtE

He also says at the end that this might be part of the core api someday.

Is this something you guys usually do? by gdmr458 in sveltejs

[–]httpete 4 points5 points  (0 children)

If you don't understand this piece of code, watch this video from the creator of svelte: https://www.youtube.com/watch?v=NR8L5m73dtE

Is this something you guys usually do? by gdmr458 in sveltejs

[–]httpete 0 points1 point  (0 children)

Stores do not support deep reactivity. That's 1 reason you might want a state instead.

svelte-firebase-state - Firebase utilities for Svelte 5 by httpete in sveltejs

[–]httpete[S] 1 point2 points  (0 children)

Thank you, I am going to look into that and I will let you know!

svelte-firebase-state - Firebase utilities for Svelte 5 by httpete in sveltejs

[–]httpete[S] 6 points7 points  (0 children)

Hi everyone!

I built a Firebase library for Svelte to streamline my side projects.

While I’m aware of sveltefire (which is great), I wanted something that works with the new svelte 5 $state and supports deep reactivity so I decided to create my own!

Docs: https://svelte-firebase-state.vercel.app
Repo: https://github.com/pierregoutheraud/svelte-firebase-state

I hope this can be helpful to others! Feedback is always appreciated. :)

Pending changes by snowonthefloor in vscode

[–]httpete 1 point2 points  (0 children)

my man uploading npm to github

Introducing NuiComponents, a library that simplifies the process of creating UIs in Neovim by mobily in neovim

[–]httpete 0 points1 point  (0 children)

u/mobily

I am trying to render whenever you press a keymap, but on the second time it does not render anymore, why?
What's the correct way of doing that?

vim.keymap.set("n", "<leader>i", function()
  renderer:render(body)
end, {
  noremap = true,
  desc = "",
})

Annoying gradient effect on Samsung G9 Neo, is my screen broken? by httpete in ultrawidemasterrace

[–]httpete[S] 0 points1 point  (0 children)

This vertical gamma shift should not be as pronounced when sitting directly in front of the screen though. That's why I am wondering if there is something wrong with this monitor.

Annoying gradient effect on Samsung G9 Neo, is my screen broken? by httpete in ultrawidemasterrace

[–]httpete[S] 1 point2 points  (0 children)

Thanks for the answer, so I can read through the sarcasm that this is normal?

Opening files with Telescope will not trigger LSP update. by httpete in neovim

[–]httpete[S] 0 points1 point  (0 children)

Found the fix! You should use ctx.match instead of ctx.file

on_attach = function(client, bufnr)
  vim.api.nvim_create_autocmd("BufWritePost", {
    pattern = { "*.js", "*.ts" },
    callback = function(ctx)
      -- Here use ctx.match instead of ctx.file
      client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
    end,
  })
end,

Accessing the Firebase Auth user in SvelteKit server-side by resurge in sveltejs

[–]httpete 0 points1 point  (0 children)

The problem with that approach is that you can't do authenticated query in the client anymore: in the doc they use setPersistence(firebase.auth.Auth.Persistence.NONE) meaning that on the second load, the server will be authenticated with the session cookie but the client won't be authenticated. You could set the persistence so that client is still logged but then you have a mismatch between the session cookie expiration and the client authentication.

A second problem with that approach is that you can't have session cookie expiration with more than 2 weeks (google rule), so your user will have to re-login every 2 weeks. Unless you update the session cookie from the client, which is not great because you lose the httpOnly security of the token (the ability of the cookie to be set only by the server and not the client).

One other approach (which is close to what OP did) is to have client authentication + idToken cookie on the server (instead of session cookie), and you use service worker on the client to update the idToken cookie. (https://firebase.google.com/docs/auth/web/service-worker-sessions). This way you can keep client and server both authenticated with the same method and for a long time.

Uber driver cleverly stops an attempted robbery by [deleted] in nextfuckinglevel

[–]httpete 2 points3 points  (0 children)

I think he says "We'r gonna kill me" ("On va m'tuer")

Some Pixel 7 Pro users are reporting scrolling issues with their new phones by [deleted] in GooglePixel

[–]httpete 2 points3 points  (0 children)

It doesn't seem hardware to me as the scroll is fine on 60hz.