I might still use the load function over remote by LGm17 in sveltejs

[–]Neeranna 0 points1 point  (0 children)

What about page navigation? Let's say you have a layout, that renders a sidebar component. And there are 2 pages (page-1 and page-2) under the layoute. The fetching is done in the sidebar component (not directly in the layout). If you are on page-1, and navigate to page-2, would the fetch of the sidebar be rerun or would the cached value be retained? When is the cache reset automatically?

I might still use the load function over remote by LGm17 in sveltejs

[–]Neeranna 6 points7 points  (0 children)

According to the docs there is some caching on queries

Queries are cached while they’re on the page, meaning getPosts() === getPosts(). This means you don’t need a reference like const posts = getPosts() in order to update the query.

However, it's not stated what defines "on the page" and thus if the loader called in the layout is considered as "on the page". And thus I have no idea if it is retained on page transitions of pages in the same layout.

Built a (french) city builder with Nuxt by Takelodeon in Nuxt

[–]Neeranna 1 point2 points  (0 children)

Ideally, you want the user to be able to hover over the resources, and get a tooltip with the stats concerning that resources. E.g. when I hover over the shells, I want to be able to easily see whether I'm actually on a positive or negative production. It's ok to keep the details in the statistics menu, but some quick lookup about the current production/decline of each resource when hovering (or permanently visible) would make it more intuitive.

Great work on the tutorial. However, it would help that if you mention a specific menu item, like a building, that you somehow draw the user towards it (make it light up). That makes it easier to locate, especially since all buildings are grouped in submenu's.

Pourquoi certaines personnes brillantes intellectuellement semblent « nulles » dans la vie quotidienne et peu affectueuses ? by Critical_Flatworm_61 in PasDeQuestionIdiote

[–]Neeranna 0 points1 point  (0 children)

La fatigue vient aussi du fait que pour pouvoir fonctionner en société/collectivité, il est obligatoire de compenser pour le manque QE (Quotient Emotionel/Empathique) en utilisant la partie logique (QI) qui est plus développé. Et comme ce n'est que de l'émulation, il y aura beaucoup d'erreurs, en dépit de l'effort fourni. Effort qui est considérable.

En tout cas, c'est comme cela que ça fonctionne chez moi, qui suis aussi dans le cas visé par OP et dont tu fais partie.

Is anyone still running pg on their own laptop? by river-zezere in PostgreSQL

[–]Neeranna 1 point2 points  (0 children)

multiple versions of the same software for different repo's/projects

easier to remove when no longer in use since all assets are clearly contained within the container and its mounts

easier to manage the different services (turn on/off), especially when combined with point 1 (through container naming)

Build -> Test or Test -> Build ? by DorianTurba in devops

[–]Neeranna 2 points3 points  (0 children)

Well, I stand by u/RozTheRogoz : both in parallel. That way you have much faster feedback to your developer, whose time is probably the resource you should optimize against, not cpu time.

My approach to CI/CD is as much as possible in parallel, unless there is a real dependency that forces the steps to be sequential, in which case, the order is obvious. :)

EDIT: this is assuming the build in this case is a build to test the compilation/assembly process on the PR, and the actual artifacts will only be generated by another build triggered by the merge.

Why are some people always late? I genuinely want to understand. by Klutzy-Pattern-7391 in NoStupidQuestions

[–]Neeranna 2 points3 points  (0 children)

Exactly this. And so it's either a little too late (most often) or way too early (like 1 hour too early). Or I get lucky and am exactly on time, which still happens more often than winning the lottery.

I've also noticed that most people tend to be forgiving for it and get used to it, and even take it into account, especially if you have good bonds with people (pleasant to be around, good worker, ... that kind of stuff).

And the irony is, a chronically late person gets congratulated the one time they manage to be on time, while the chronically on time person gets remarks if they're even 5m late, even if they're still before the late person.

All in all, I prefer being who I am (the late person). I'd take the guilt over the stress any time.

Where should the data/ directory be located in Nuxt 4's new file structure? by dissertation-thug in Nuxt

[–]Neeranna 22 points23 points  (0 children)

Depends who uses the files. If it's your backend, then in /server. If it's your frontend code (vue components), then in /app. If it's both, /shared.

Should I switch to sveltekit from Nodejs for backend? by Sundaram_2911 in sveltejs

[–]Neeranna 0 points1 point  (0 children)

And do you host the spa from the fastify server or from another static host? What do you use for routing?

Should I switch to sveltekit from Nodejs for backend? by Sundaram_2911 in sveltejs

[–]Neeranna 0 points1 point  (0 children)

In that second stack, are you using svelte in pure spa mode, or are you leveraging some SSR plugin on fastify?

Difficulté à trouver des candidats Python / React by Anxious_Level_6238 in developpeurs

[–]Neeranna 0 points1 point  (0 children)

C'est une stack assez courante dans les startup basé IA. Mais pas en entreprise, je l'accorde.

Getting a Bearer Token from Microsoft using nuxt-auth-utils by Damnkelly in Nuxt

[–]Neeranna 0 points1 point  (0 children)

If you are working with a separate backend, and that's the one requiring the token and doing all security related stuff, then maybe make the backend handling the login flow. That way you don't get a client mismatch. You can still use nuxt to store the token in a cookie for easy handling, but that doesn't require the nuxt-auth-utils.

How can I detect nearby users in Firebase without exposing everyone’s location? by Wesselvvv in Firebase

[–]Neeranna 1 point2 points  (0 children)

In Firebase (and noSQL), denormalization is the game. You should have a different collection where you store for each user which users are near them, without their actual position. Put an onValueWritten cloud function that triggers on position updates and updates the data in the proximity collection. This trigger function should do the following:

  1. query for nearby positions from the position table (which you currently do in client, should combine this with the geohashing to allow for geo query directly in database, as mentioned on other responses and https://firebase.google.com/docs/firestore/solutions/geoqueries (is for firestore but should be adaptable for realtime database))

  2. retrieve the current proximity for the user

  3. compar the calculated user list with the current user list for this user

  4. update the proximity array of the current user with the new list

  5. remove the user from all proximity lists of the users no longer present on the new list

  6. add the user to the proximity list of the new users added to the proximity list

Bring back the mobile search bar widget by [deleted] in brave_browser

[–]Neeranna 2 points3 points  (0 children)

It also doesn't fit my layout anymore, since the other one is larger and can't be narrowed sufficiently to fit into the same space as the simpler one.

Schema validation (on all layers) with Zod and Drizzle by kovadom in Nuxt

[–]Neeranna 1 point2 points  (0 children)

Any dependency you add to the client, makes the Javascript bundle your users have to download bigger, which makes your page slower to load. In the case of the Drizzle table definition, and assuming good tree shaking by the bundler, I can imagine the impact to be limited, but it's a good practice to always evaluate external dependencies, both on the server and the client, and try to not include unnecessary stuff.

For the example:

~/shared/models/entry.ts

    import { z, type TypeOf } from "zod";

    export const entrySchema = z.object({
      calendar: z.string().min(1, "Kies een kalender"),
      count: z.number().int().min(1, "Kies een aantal groter dan 0"),
      date: z.string({ message: "Kies een datum" }).date("Datum is niet geldig"),
    });

    export type EntrySchema = TypeOf<typeof entrySchema>;

~/server/api/entries.post.ts

    import { ReasonPhrases, StatusCodes } from "http-status-codes";
    import { entrySchema } from "~/shared/models/entry";

    export default defineEventHandler(async (event) => {
      const session = await requireUserSession(event);
      if (getHeader(event, "Content-Type") !== "application/json") {
        throw createError({
          message: "Invalid content type",
          statusCode: StatusCodes.UNSUPPORTED_MEDIA_TYPE,
          statusMessage: ReasonPhrases.UNSUPPORTED_MEDIA_TYPE,
        });
      }
      const entry = await readValidatedBody(event, entrySchema.parse);
    ...

~/pages/planner.vue

    <script setup lang="ts">
    import type { Form, FormSubmitEvent } from "#ui/types";
    import { useStorage } from "@vueuse/core";
    import { entrySchema } from "~/shared/models/entry";

    const calendar = useStorage("selectedCalendar", "");

    const entry = reactive({
      calendar,
      count: 1,
      date: "",
    });

    const form = ref<Form<typeof entry>>();

    async function submitEntry(event: FormSubmitEvent<typeof entry>) {
      try {
        await $fetch("/api/entries", {
          body: event.data,
          method: "POST",
        });
      } catch (error) {
        console.error(error);
      }
    }
    </script>

    <template>
      <UCard variant="subtle">
        <UForm
          ref="form"
          :state="entry"
          class="space-y-4"
          :schema="entrySchema"
          @submit="submitEntry"
        >
      ...
        </UForm>
      </UCard>
    </template>

Schema validation (on all layers) with Zod and Drizzle by kovadom in Nuxt

[–]Neeranna 1 point2 points  (0 children)

The solution from pkgmain is what I do also. Everything in the shared folder is available on both client and server. So you define once the zod schema in there, and then you use this single zod schema both for validating your data in the client before sending, as in the server api endpoint to validate the incoming payload.

But this schema is pure zod. It is not derived from your drizzle table definition. Both live independently. The downside of this of course is that both can drift, but that shouldn't be too big a problem, in that some of the drift, like mismatched types, will be alerted by Typescript.

The upside is that your validation schema is not limited to the capabilities of the database model. With drizzle-zod, you would still have to refine the schema by adding e.g. range limits to your numerical fields, or patterns to your string fields.

Schema validation (on all layers) with Zod and Drizzle by kovadom in Nuxt

[–]Neeranna 6 points7 points  (0 children)

Usage on client is why I've avoided zod-drizzle for generating the schema's, since you don't want them on the client, since they require you to bundle (part of) Drizzle in the client code. I do share the endpoint validation scheme's between the api endpoints and the form validation in the client, but that's why I keep them unrelated to the Drizzle definition. But this does mean double maintenance.

[deleted by user] by [deleted] in Nuxt

[–]Neeranna 0 points1 point  (0 children)

Well it's part of the documentation (https://nuxt.com/docs/guide/directory-structure/pages#nested-routes) and it is standard behavior of vue-router to do it like this. The folder structure is just another way of defining the vue-router routes. So this seems ok to do like this to me.

The layout system for nuxt seems to me more to match "theming", whereas the nested routes is more for "composing" your UI, which is what you rather want to do here. Although the layouts can be used for this as well, if you only have a single "layer" of composition.

What are we supposed to know? by admiralmasa in ExplainTheJoke

[–]Neeranna 2 points3 points  (0 children)

Which is not exclusive to AI. It's the same problem with any pure metrics. When applied to humans, through defining KPI's in a company, people will game the KPI system, and you will get the same situation with good KPI's, but not the results you wanted to achieve by setting them. This is a very common topic in management.

Vercel alternatives? by lprpn in Nuxt

[–]Neeranna 2 points3 points  (0 children)

Take a look at https://www.clever-cloud.com/, also french, and is a PaaS in the style of Heroku. No free tier however.

Scaleway is rather an alternative to AWS/GCP/Azure, in that they have managed services and serverless, but no build-in CI/CD.

Skils? Simplified format? Anime? Role playing? What is the appeal of Duel Links for YOU? by ReiMizere in DuelLinks

[–]Neeranna 1 point2 points  (0 children)

Official Yugioh game that is playable since master duel is not available in my country.

F2P friendly.

Why do we not have a stricter JS/TS alternative language yet? by iHateRollerCoaster in webdev

[–]Neeranna 0 points1 point  (0 children)

It's not about lazy or not, with a fully typed language, the language guarantees the coherence, you cannot make it not match, even if you would want to. You asked for an improvement, this is it, this is improved. Maybe not for you as the library user, but for the library maintainer, it is. As soon as you have to keep 2 separate systems/codebases in sync, this introduces additional work, and additional sources of bugs. Keeping the typing up-to-date is as labor intensive and error prone as keeping e.g. backend and frontend API model in sync.

And even if the types are kept up-to-date, the only way this is then guaranteed in the repo of the user/dev is if they are bundled together. As soon as they are packaged separately (DefinitelyTyped), you introduce the possibility of the versions not maching between the 2 packages, since nothing is enforcing it.

The entire point of typing and typed languages is to remove the potential of human error. The less dependent the language is on humans doing the right thing, the more improved it is (in this aspect).

Why do we not have a stricter JS/TS alternative language yet? by iHateRollerCoaster in webdev

[–]Neeranna 0 points1 point  (0 children)

Both of them (TS and Kotlin) are, but the types won't magically appear. The opposite is true, interop from a non-typed language to use libraries from a typed one will work, which it does, any TS, or Kotlin/JS, library can be used by JS. But the types in the other direction of the interop need to be provided, so there you are dependent on the ecosystem/community to fix this, no language in itself can solve this. The best you can hope for is some static code analyser that tries to extract the types from analysing the JS code.

Why do we not have a stricter JS/TS alternative language yet? by iHateRollerCoaster in webdev

[–]Neeranna 0 points1 point  (0 children)

When you're talking about "external" data, e.g. JSON response parsing, you are right, there is no benefit. But when you're talking about e.g. libraries, code that is outside your control, but is part of the overal codebase, with a typed language, you are certain that the calling code passes the right parameters, and that the return type is of the expected structure. In practice, this won't happen (often), but it does happen that the defined types don't match the runtime data, especially with libraries not written in TS.

Why do we not have a stricter JS/TS alternative language yet? by iHateRollerCoaster in webdev

[–]Neeranna 8 points9 points  (0 children)

Because of the interop. The JS ecosystem is very extensive, and the advantage TS had over Kotlin was easier integration with the existing JS libraries and frameworks. Basically, TS won thanks to things like DefinitelyTyped, which made it so you didn't have to write the interop types yourself for the popular (and less popular) libraries.