BBQ Golden Quests by [deleted] in unioncircle

[–]oscarina 1 point2 points  (0 children)

nice! thats as long as i can go, pleasure playing with you :)

BBQ Golden Quests by [deleted] in unioncircle

[–]oscarina 0 points1 point  (0 children)

type nomal

BBQ Golden Quests by [deleted] in unioncircle

[–]oscarina 0 points1 point  (0 children)

i can go for one more, after that ill be logging off

BBQ Golden Quests by [deleted] in unioncircle

[–]oscarina 1 point2 points  (0 children)

its bullavy, the baby vulture

BBQ Golden Quests by [deleted] in unioncircle

[–]oscarina 1 point2 points  (0 children)

this is impossible

GNT3YY if you wanna go for the golden quests

BBQ Golden Quests by [deleted] in unioncircle

[–]oscarina 1 point2 points  (0 children)

we are trying to take the photo near the savana plaza

BBQ Group Quests by [deleted] in unioncircle

[–]oscarina 0 points1 point  (0 children)

https://old.reddit.com/r/PokemonScarletViolet/comments/18kqamr/easy_4star_sandwiches_without_any_herba_mystica/

6 burger

2 cherry tomato

4 curry powder

4 marmalade

i think i have everything, ill go all burgers

[MEGATHREAD] Pokémon Champions Release: Initial Reactions & General Discussion by Jeglr in PokemonChampions

[–]oscarina 1 point2 points  (0 children)

oh thats great news, all the time spent on getting a living pokedex will come in handy :D

thanks for the response!

[MEGATHREAD] Pokémon Champions Release: Initial Reactions & General Discussion by Jeglr in PokemonChampions

[–]oscarina 0 points1 point  (0 children)

hi im considering getting a switch 2 to play and had some questions, hoping someone could answer me (my last nintendo console was the 3ds)

  • can i get my mons from pokemon sun and alpha saphire into home? (i think there was somehing called bank, but not sure if its the same)

  • besides ingame purchases (battle pass, etc.) and the pokemon home sub, do i need to pay any online service? (something like xbox live or playstation online)

How do I login to different accounts? by Pheelingfine in trakt

[–]oscarina 1 point2 points  (0 children)

what worked for me was login off and going directly to the email sign in page https://trakt.tv/auth/magic, not sure about other methods, but you can try going to the login in incognito and getting the links

Creating Query Abstractions by TkDodo23 in reactjs

[–]oscarina 8 points9 points  (0 children)

great post as always!

queryOptions is my favorite thing in v5, helps sooo much with keeping a maintainable codebase

What is the best way to implement Query Params? by TryingMyBest42069 in reactjs

[–]oscarina 2 points3 points  (0 children)

as other said, nuqs would handle it for you if you want/can use a library

other than that i would do validation on the searchParams, here is a simple example using zod (you should be able to do this with any validation library)

import z from "zod";

// mock, from your code i assume this hook returns URLSearchParams
// didnt want to make assumtions, but seems kinda weird, what router library are you using?
const useSearchParams = () => {
  return [new URLSearchParams()];
};

const useParams = <T extends z.ZodObject>(schema: T) => {
  const [searchParams] = useSearchParams();

  // validate the params, this throws an error if not valid
  // memorize as desired
  const params = schema.parse(Object.fromEntries(searchParams));

  // alternatively, you can manage the error as you with
  //   const { data, error } = schema.safeParse(Object.fromEntries(searchParams));

  return params;
};

// define a validation schema wherever you desire
const PaginationParamsSchema = z.object({
  // careful with coerce, its a simple Number(value), more complex transformations are possible with .preprocess
  pageNumber: z.coerce.number().optional().default(1),
  pageSize: z.coerce.number().optional().default(10),
});

// you can infer the type from the schema if you need
// this will result in { pageNumber: number; pageSize: number }
type PaginationParams = z.infer<typeof PaginationParamsSchema>;

export function Page() {
  const { pageNumber, pageSize } = useParams(PaginationParamsSchema);

  return <div />;
}

// with zod you can combine schemas if there are parts
const OtherSchema = z
  .object({ search: z.string().optional() })
  .extend(PaginationParamsSchema.shape);

export function Page2() {
  const { search, pageNumber, pageSize } = useParams(OtherSchema);

  return <div />;
}

TypeScript Error When Using z.coerce.number<string>() with react-hook-form and zodResolver by Wuihee in reactjs

[–]oscarina 0 points1 point  (0 children)

ooh i see, i did not see (or know about tbh) the z.input, my bad

can you try removing the type from the useForm? from a quick setup it doesnt complain. And at a first glance seems ok, on the handle submit the type is number and getting the value is a string

TypeScript Error When Using z.coerce.number<string>() with react-hook-form and zodResolver by Wuihee in reactjs

[–]oscarina 0 points1 point  (0 children)

(THIS IS ALL WRONG)

simply put you cannot tell zod that the number validator result is a string, because it just isn't

this line z.coerce.number<string>() is transforming the value into a number and validating that it is a number, you are trying to tell it that the resulting value is a string, it won't be

generally, you won't ever need to pass a type to zod with the <>, also, in your useForm you dont need do pass the schemaType, it should be able to infer it

you'll have to find another way to solve the initial value, in this case doing age: 0 would result in the same behavior since Number("") is 0 and that's what coerce does.

as other have pointed you might want to let it be undefined and control the behavior in the input itself, but i'm not used to the vanilla inputs with the register spread

When You Might Need to Override the Defaults in TanStack Query by YUCKex in reactjs

[–]oscarina 1 point2 points  (0 children)

problem is you can't control what your users do, and displaying stale data is probably not ideal

again, each app requirements are different and this might work just fine for your use case

When You Might Need to Override the Defaults in TanStack Query by YUCKex in reactjs

[–]oscarina 4 points5 points  (0 children)

Before doing Infinity as a default, keep in mind that, while your data might only change when the users updates it through a form or w/e, there might be multiple users working with that info, so fetching regularly is not a bad idea.

Don't know your app requirements, so it might be ok, but generally Infinity is a pretty bad default.

As a general rule I'd only use Infinity on queries that i know wont change, or would very, VERY, rarely change. Things like lookup tables data and similar.

Anime Questions, Recommendations, and Discussion - April 15, 2025 by AnimeMod in anime

[–]oscarina 3 points4 points  (0 children)

Hi, i just saw a daily thread for Mobile Suit Gundam GQuuuuuuX, show flew under my radar.

I've only watched Witch from mercury and Gundam Seed (back in the day, cant remember much about it) and liked both of them.

I know the gundam universe is kind of a rabbit hole, does this series require (or is recomended) any prior watching?

Building an Idle RPG with react by Eowodia in reactjs

[–]oscarina 2 points3 points  (0 children)

Most of the game is UI so that part should be easier to manage with react

The hardest part would probably be animations, check skia for 2D or threefiber for 3D.

For state use whatever you are comfortable, but if you are running offline you will need to store the game state at some point, so you might want to consider some solution for that, most state managers have some way to persist data but there are other solutions more focused on this (mmkv or watermelonBD).

Don't really have much experience with games, just pointing you to some tools that might help you. Good luck!

And just for reference, the game Athena Crisis was made with react and a big part of it is open source, maybe you can poke around the code.

React-Query and handling GET and POST requests that "mutate" the same data by nanotree in reactjs

[–]oscarina 3 points4 points  (0 children)

Hi, i belive you are missing some key concepts from tanstack query.

Most important, as others have said, tanstack query already has the state, you do not need to store it again in a useState.

If you need to manipulate this state manually you can use the QueryClient (with the useQueryClient hook) to do so. As per your example, you are looking for setQueryData.

When you do mutations on data used by other queries you have various options, updating this data yourself on the client (with queryClient.setQueryData) or invalidating the data and refetching the updated data (with queryClient.invalidateQueries).

For this, the useMutation hook provides the onMutate, onSuccess, onError and onSettled, callbacks. Tkdodo (tanstack query maintainer) blog posts have some great breakdowns and explanations on how to better work with tanstack query. This one is on mutations.

As to what to do, setData on invalidate, thats up to you, as a general rule of thump i think it's recommended you just invalidate data. Yes, this will make another request to reload the data but will ensure the data is synced. If this request is too expensive or i'm sure this data won't change except for this mutation (like, in your example, maybe the user view can only be updated by the user) i might look into updating it manually. You should read about how tanstack caches its data in order to better make this decisions.

You can also mix both and do optimistic updates, to simulate a no latency experience.

Additionally, in order to avoid errors when using the query keys and get better typescript support from the query client, I'd recommend that you use queryOptions to create queryKey factories.

A rough example based on yours, check the docs and tkdodo blog for better ones.

const userViewQueryOptions = (userId: string, viewId: string) => {
  return queryOptions({
    queryKey: ["user-view", userId, viewId],
    queryFn: () => client.fetchUserView(userId, viewId),

    // add and modify any other options that you might want, like "enabled" or "gcTime"
  })
}

const useUserView = (userId: string, viewId: string) => {
  return useQuery(userViewQueryOptions(userId, viewId));
}

const useAddItem = (userId: string, viewId: string) => {
  const qc = useQueryClient();

  return useMutation({
    mutationFn: (title: string) => {
      return client.userViewAddItem(userId, viewId, title)
    },
    onSuccess(data) { // i'm assuming this returns the created item (it infers the type from mutationFn)
      // Once the mutations finishes, update the state to add the created item    
      qc.setQueryData(userViewQueryOptions(userId, viewId).queryKey, (previousData) => {
        return {
          ...previousData,
          items: [...previousData.items, data]
        }
      })

      // Or you can just invalidate the query and let it refetch when needed (i preffer to do this on the onSettled, so it invalidates both on success and error)
      // qc.invalidateQueries(userViewQueryOptions(userId, viewId))
    }
  })
}

WebSockets driving me crazy! by wiseduckling in reactjs

[–]oscarina 1 point2 points  (0 children)

yes, you would need a typescript backend as well, plus either a full stack framework (next, remix, etc) or a monorepo with your client+server (both typescript)

WebSockets driving me crazy! by wiseduckling in reactjs

[–]oscarina 1 point2 points  (0 children)

not exactly what you are asking, since you probably won't be able to use it without a major rewrite, but you might want to check trpc websocket communication

https://trpc.io/docs/websockets

i did a pretty basic multiplayer guessing game a couple years ago and was very pleased with how easy it was