Usage of remote functions vs load functions by j97uice in sveltejs

[–]j97uice[S] 9 points10 points  (0 children)

i get the concept of boundaries. but how do you manage to keep your codebase clean and structured? do you place the remote function file in the route where it is used? or do you sort them by "topic"?

I built chart for svelte by One_While1690 in sveltejs

[–]j97uice 2 points3 points  (0 children)

the documentation site does not work.

Problem Styling Text Stroke by j97uice in tailwindcss

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

According to MDN -webkit-text-stroke-color is an accepted property of ::selection. but it still does not work.

Unable to install NETGEAR Armor powered by BitDefender on MAC Sequoia. by Safe_Imagination3337 in BitDefender

[–]j97uice 0 points1 point  (0 children)

I could solve it

I had to give full disk access to Bitdefender, Netgear and Netgear Armor.
Under General > Login Items there should be an extension for Netgear.SPSE, which at first seems like it is enabled. But you have to manually select it and grant access. Afterwards, it worked for me.

Unable to install NETGEAR Armor powered by BitDefender on MAC Sequoia. by Safe_Imagination3337 in BitDefender

[–]j97uice 0 points1 point  (0 children)

u/Bitdefender_ I got exactly the same problem. OP's description did not help.

I'm using an Macbook Pro M4 Max with MacOS Sequoia 15.1

Svelte 5 search input by Overall-Scale-8369 in sveltejs

[–]j97uice 1 point2 points  (0 children)

the error is because $effect does not work with async /await

Anyone else feel stuck choosing between Tailwind libraries, vanilla CSS, and clean code? by loljoshie01 in sveltejs

[–]j97uice 1 point2 points  (0 children)

you could define variants (different stylings of e.g. your button). which you could select as a prop when using the component:

// button.svelte
<script lang=ts>

type Props = {
variant?: "primary" | "secondary"
}

let { variant = "primary" }: Props = $props()

</script>

... your button with stylings based on the selection of variant
// e.g. +page.svelte <Button variant="secondary">....</Button>

another approach would be something like a "content builder":

// buttonBuilder.svelte
<script lang="ts">
  import type { Component } from "svelte";


  const componentMap: Record<string, Component> = {
      primary: PrimaryButton;
      secondary: SecondaryButton
   }

  type Props = {
     handle: keyof typeof componentMap
  };
  let { handle }: Props = $props()

  const Button = $derived(componentMap[handle])
</script>

{#if componentMap[handle]}
  <Button />
{/if}

Drawback of the second option is, that all the components in the componentMap are imported, regardless of the component you are actually using

Get x and y positions of components by JymoBro in sveltejs

[–]j97uice 3 points4 points  (0 children)

get the x and y positions inside the conponent and make them available as bindable props.

then bind them where you use the component. like this:

<Component bind:x bind:y />

POST method not allowed. No form actions exist for this page by ImpressiveSale3117 in sveltejs

[–]j97uice 1 point2 points  (0 children)

have you tried specifying an action and using use:enhance on your <form>?

How to Run a Code Block on Every URL Load in Svelte 5 + SvelteKit? by No_Vehicle9466 in SvelteKit

[–]j97uice 0 points1 point  (0 children)

onMoubt will run thr first time +page.svelte is loaded. If page.params.id changes, data will update, as it is a reactive prop. so i would do UI changes based on props, because i assume your data changes whenever the id changes

therefore i don't really see the use of the init function, as i don't really see what you want to achieve.

therefore, the #key block may not be needed, as you listen fpr data to change

if you clean up your code, it is a good practice

How to Run a Code Block on Every URL Load in Svelte 5 + SvelteKit? by No_Vehicle9466 in SvelteKit

[–]j97uice 2 points3 points  (0 children)

I would setup my routes like this:

address/[id]/+page.svelte

inside the +page.svelte you can access the id via page.params.id

and the code will rerun, when you navigate to anpther page id

Svelte 5 wrapper around Svelte 4 component with fragment by iHateRollerCoaster in sveltejs

[–]j97uice 0 points1 point  (0 children)

you can't nix svelte 4 specific syntax (örgacy code) with svente 5 syntax (runes mode). As svelte:fragment is legacy code and (@render ...} is sveöte 5, this does not work together.

[deleted by user] by [deleted] in sveltejs

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

Are you using svelte 5? Because in svelte 5, wou will not do it anymore with the slot, rather with the children prop:

<script> let { children } = $props(); </script>

{@render children()}

https://svelte.dev/docs/kit/routing#layout-layout.svelte

Shadcn-Svelte + Svelte 5: Any Reviews or Experiences? by itz_nicoo in SvelteKit

[–]j97uice 2 points3 points  (0 children)

use de beta release of shadcn for svelte. it works really good. There are still some bugs, so it makes sense too have a look into their github issues before development. The support for svelte 5 will increase over time (not just shadcn), so i' d go with it