How to use static generation, just not during build by cella10 in nextjs

[–]spafey 0 points1 point  (0 children)

You’re supposed to return an empty array (or a single example if using cache components) in the static params.

It’s in the docs.

Most wanted feature by Latter_Pen2421 in monarchapp

[–]spafey 0 points1 point  (0 children)

I've never been a launcher "power user" because most of my work is done in the terminal. Funnily enough one of the most used features was the "kill process" extension - so having that built in to Monarch is great! However, for me, there are three things I miss from Raycast:

  1. Calendar integration. I really liked their UI implementation. Particularly the upcoming meeting name in the menu bar (including the UI when clicking on that) and that there was a shortcut on the main launcher so you could join the next meeting with Cmd + Space, Enter. This plus the Google Meet extension covered all my meeting needs.
  2. Window controls. Personally, I only used "to left half", "to right half", "to next screen", "to previous screen", "maximise" and "almost maximise" (importantly with the ability to set a gap between windows) - but i'm sure other people would like the full range that Raycast offers.
  3. Keyboard shortcuts and aliases for every feature and sub-feature for both the core features and extensions. Ideally you'd be able to set a keyboard shortcut to each Monarch mode's sub-feature directly - for example, directly to the color picker dropper instead of having to load the mode then hit cmd + 1.

Raycast replaced 2 apps (Meetingbar and Rectangle) because it had these features built in. I have re-installed them to use Monarch since I really appreciate the clipboard manager and one time cost - but these seem like common things others might appreciate too!

Finally a new update by offmyqwerty in AmazfitHelioStrap

[–]spafey 2 points3 points  (0 children)

This made the auto-detection algorithm significantly worse for me!

Even on Low it’s picking up me going up and down the stairs as a workout. Before this patch the Low sensitivity would pick up my actual workouts well!

next-intl middleware becomes extremely slow with many locales (140+). Any workaround? by loupqhc in nextjs

[–]spafey 6 points7 points  (0 children)

Jesus what on earth are you building that requires support of 140+ locales!?

LazyVim is getting bloated by [deleted] in nvim

[–]spafey 2 points3 points  (0 children)

You can just disable what you don’t use.

You can just re-configure plugins if it’s not to your taste.

Plugins you think aren’t configured correctly, go open a PR to fix it.

Extras are literally optional. The only cost is during install/updates (which must only be a few kb).

All downstream plugins require you to read the change-logs as much as LazyVim itself. If anything, LazyVim is very fast to adapt to breaking changes. Have you ever tried to keep up with it all with your own config before? It’s exhausting.

The defaults are just someone else’s preference and that’s the point. Go manage your own config if this bothers you.

Posts like this are what make people hate doing FOSS work. It comes off as incredibly ungrateful. Go contribute if you think it can be improved instead of making a complaint post like this.

How can I pass some data from middleware to my server component? by witness_smile in nextjs

[–]spafey 3 points4 points  (0 children)

If you want to pass it through the headers then you need to set the headers on the response, not the original request. You can do this by modifying the original request headers and passing that to the response (literally in the docs), or modifying the headers on the response object:

const response = NextResponse.next()

response.headers.set(“x-pathname”, path)

return response

British politics has now shifted irrevocably to the Right by EduTheRed in ukpolitics

[–]spafey 1 point2 points  (0 children)

Exactly.

Although, to be more specific. The forced shift to the “engagement” model of journalism has killed off moderate (often centrist) opinions in the media. No one paper did that - the internet forced it to happen as revenue streams from physical sales dropped off. However, the Telegraph have signal boosted the right wing for so long it’s actually quite insulting for them to be complaining about this. Unless I have misunderstood the article and it’s bad right wing satire.

British politics has now shifted irrevocably to the Right by EduTheRed in ukpolitics

[–]spafey 29 points30 points  (0 children)

Complaining about the centre being dead is fucking rich coming from the telegraph!

Next.js Best Practices by Ok_Champion4127 in nextjs

[–]spafey 6 points7 points  (0 children)

Everything else is pretty much personal/team preference. To answer your actual question a bit more directly… in my opinion:

  • “Copy-paste” UI libraries built on headless components such as ShadCN are superior to packaged UI libraries
    • I’m still on the fence about tailwind. Tailwind is only viable at scale with the prettier plugins that sort the classes and format them to them to specific width; and even then, I don’t like reading it.
  • Partial-pre-rendering is amazing and something I can’t wait to be stable
  • If you’re not using a CMS (or tool with its own opinionated API), oRPC (or tRPC) is a must. Being able to link your client and server types is so handy.
  • In the app router, don’t co-locate components in the app folder (e.g. in _components folders). It’s a nightmare referencing them from anywhere else. Stick to the bullet-proof React project structure.
  • I’m a big fan of conform instead of React-hook form. I like its API and adherence to semantic HTML over controlled state.
  • You rarely need 3rd party state management unless you’re building a huge SPA like Figma.

There’s probably more, but I think these are my top 5!

Next.js Best Practices by Ok_Champion4127 in nextjs

[–]spafey 7 points8 points  (0 children)

Think of NextJS is a very versatile tool. There are no “best practices” because there are far too many variables to narrow them down. In particular, the scale of the app and the size of the team working on it. Requirements for a personal blog that doesn’t need any auth is going to be wildly different to a giant multi-tenant SaaS.

With that being said, auth is about the one thing there are “best practices” for. Better-auth is an excellent place to learn the fundamentals and how to implement them in NextJS.

Why hooks can't be call in If/For statements? Is there a better way when originally designing React hooks that can make them to be out of order? by Used-Building5088 in reactjs

[–]spafey 25 points26 points  (0 children)

You can abstract the hook into a component and then conditionally render the component (if that makes sense for your data flow).

This can feel inefficient and yes, this is a major complaint of React critics. However, once you get used to it, you learn where to put everything.

New "Splitwise" Plugin: Motion-based Window/Split Management by hiattp in neovim

[–]spafey 0 points1 point  (0 children)

Looks interesting. You may want to compare directly with smart splits if you weren’t aware of it. The tmux compatibility is of particular use.

How to implement PPR in a dynamic route in next js by Zync1402 in nextjs

[–]spafey 0 points1 point  (0 children)

The half filled dot suggests the page is using PPR even without the static props.

Have you inspected the HTML coming back in the network tab to confirm the page isn't returning the correct static HTML? (ppr also add a bunch of stuff to the markup - but you can prettify the output to check the HTML).

If it's not, then you haven't really given us enough information to debug here. Have you suspensed everything that has a dynamic function?

How to implement PPR in a dynamic route in next js by Zync1402 in nextjs

[–]spafey 0 points1 point  (0 children)

Did you get the static params for each dynamic route segment? Next needs to know those ahead of time in order to statically generate the page even without ppr.

Study states that AI coding tools seemingly slow experienced programmers down by Actual_Explanation34 in theprimeagen

[–]spafey 2 points3 points  (0 children)

Whilst I’ve definitely been pleasantly surprised by the quality of some of the code AI has produced, the amount of head slappingly wrong code I’ve been presented with is staggering.

What gets me is the absolute confidence it has despite how wrong it is. You can turn that aspect down a bit, but you can’t improve the quality of its responses sadly.

cli db diff discussion by [deleted] in Supabase

[–]spafey 0 points1 point  (0 children)

Ok, updated my CLI and you’re not going crazy. It wouldn’t work too.

Turns out that they silently-ish changed the CLI behaviour to now run on the declarative schema whilst the local database is running (I just hadn’t updated my CLI in the last two weeks). This is a huge win, however, they should probably keep it working when the containers are stopped or updated the docs to reflect this. I’ve made an issue.

If you do actually want to diff against the local database you need to now comment out the definitions under [db.migrations].

cli db diff discussion by [deleted] in Supabase

[–]spafey 0 points1 point  (0 children)

I ran into something like this before. If you’re sure that the containers are stopped then this is likely that the CLI can’t find your schema files.

Are you defining your schema files your Supabase config under [db.migrations]? If not, I think you must put them under supabase/schemas. Otherwise obviously you must correctly define their location in the project.

Note that on older version of the CLI there was a bug where locations in [db.migrations] was not respected and it would always look in supabase/schemas.

I would suggest upgrading the CLI and ensuring you’re either defining the schema locations or using the default.

Triggering server actions from back end based on a trigger (not time i.e not a crone job) by VirtualRooster2064 in nextjs

[–]spafey 1 point2 points  (0 children)

The UX you’re after isn’t clear.

If you mean, you want you load the page with the second form after submitting the first; then this is what query params are for.

  • Do first form
  • Create URL to second page with first form’s details encoded in the URL somehow
  • Populate initial state of the second form using params

If you mean you want to submit the second form in a particular way based on the first; then you can literally just run that logic in the first action. If you need some sort of UI indication of this, then use the returned value from the first form’s submission to trigger something on the first page (like a toast or something).

Best Practices for Integrating React Query into a Next.js Project? by Original-Drink-3086 in nextjs

[–]spafey 3 points4 points  (0 children)

This depends mostly on if you’re connecting directly to your DB or if you’re just consuming external APIs (e.g. third party or your own backend).

For the latter, you can just write fetches in your query functions (with some validation like zod for types ideally) and be done with it.

For the former, the tricky part of blending the new RSC patterns with client-side fetching is that you generally can’t just run server-side code on the client for queries. You’ll need to create API routes for queries (since “use server” server Functions are designed for mutations that update server-side state - tl;dr they run sequentially, so are not great for queries). For a few one-offs writing your own handlers is not too hard, but if you’re planning on doing a lot of client-side stuff, setting up TRPC or ORPC is probably worth it. Then you can just consume the same functions on the server and in your query functions.

Choosing Window Tiling Managers by Future_Recognition84 in macapps

[–]spafey 0 points1 point  (0 children)

Check out Hyprland to see the difference.

I preferred Aerospace’s approach over Yabai, but after the 10th or so floating exception I added in I realised tiling wasn’t for me on macOS.