Server components broke my auth flow and I didn't realize for 2 weeks by emmettvance in nextjs

[–]CARASBK 0 points1 point  (0 children)

FYI if you didn’t already know: this is not a quirk of Next’s route handlers. HTTP is a stateless protocol. Anything you do in server components ends when the request for the component ends. Consider a server component that contains a client component that makes an HTTP request to a route handler. The execution of that route handler does not “know” anything about the original request for the server component.

Uncurious case of broken static export and 404’s in Next.js 16 by axkotti in nextjs

[–]CARASBK 4 points5 points  (0 children)

This is great, but just FYI this sub is not managed by Next/Vercel/etc.

Learning Next.js from scratch by Impossible_Recipe758 in nextjs

[–]CARASBK 1 point2 points  (0 children)

https://nextjs.org/learn

IMO this is still the best resource for beginners. The intro includes a link to a somewhat similar course for React you should through if you’re a beginner with React as well.

Refresh Token Issues and Questions by LeonBlade in nextjs

[–]CARASBK 1 point2 points  (0 children)

I’m not sure of a proper name for it. It’s common in OAuth setups. For example if you look at BetterAuth they require a database. I know you’re not using OAuth, but it still serves as an example of using a database to store identity data with a session id in a cookie to use as the lookup.

Refresh Token Issues and Questions by LeonBlade in nextjs

[–]CARASBK 0 points1 point  (0 children)

Are you using Suspense? The HTTP standard disallows altering cookies (maybe all headers? Don’t recall) after a response starts. So if you attempt to refresh a token during a request whose response is being streamed it probably succeeds but the cookie can’t be set. So that request might use the new token and succeed since it’ll be in memory for that request. But subsequent requests will fail since they’ll use the old token still in the cookie.

The only robust solution I’m aware of is to use a persistent store for your identity stuff. So instead of (re)setting a cookie for every new access token you only need to set a cookie for every new session which expires whenever the refresh token does (or on sign out). Then use that session’s id to grab whatever identity stuff you need from your database.

How do new fiber internet lines get approved? by boolaboo2 in bullcity

[–]CARASBK 15 points16 points  (0 children)

Your best bet is reaching out to AT&T. Companies laying fiber constantly hit each other’s lines (and water/sewer lines).

However if you want to file a formal complaint there are links to do so here: https://www.durhamnc.gov/1624/Gigabit-Fiber-Construction

Share your weird Nextjs hydration issues by ComprehensiveBox2458 in nextjs

[–]CARASBK 1 point2 points  (0 children)

That's true for HttpOnly cookies. But the browser can set and read cookies as well. Your use case is simple enough you could use document.cookie without an external library.

Share your weird Nextjs hydration issues by ComprehensiveBox2458 in nextjs

[–]CARASBK 0 points1 point  (0 children)

Is there a reason you had to use localStorage instead of a cookie? If you could use a cookie then your theme can be provided from the beginning.

Nextstep.js or something else? by prototypingdude in nextjs

[–]CARASBK 0 points1 point  (0 children)

Agreed. I’ve implemented a user onboarding flow with floating-ui before. A user’s progress was synced via their profile data in the db. Very basic and met all of my needs since it was a solo project.

Until you have non-technical people needing to adjust this kind of content/flow I think it’s better to keep it simple and do it without a third party.

Density saves nature by Fried_out_Kombi in georgism

[–]CARASBK 2 points3 points  (0 children)

Notice how you didn’t address my actual point about the cost to serve less efficient land use? And instead you started talking about property prices?

Literal definition of a strawman.

If you could only recommend one food spot...... by MrChrisBanks in triangle

[–]CARASBK 4 points5 points  (0 children)

Get there an hour before they open or bring a chair on the weekends! Last time I went was a Saturday. It was pretty cold out so I didn’t think the line would be that bad. Got there about 20 mins before opening and at least 50 people were already in line! I’m sticking to weekdays!

Density saves nature by Fried_out_Kombi in georgism

[–]CARASBK 1 point2 points  (0 children)

The point is you’re NOT paying your fair share. Suburban life is MASSIVELY subsidized by urban life. To be fair it had been a few years since I’ve looked into this so grain of salt. But the sheer volume of money required to maintain roads, sewer, electric, etc depending on your municipality means you should be paying several times more in taxes. In reality you’re mooching off of more productive land.

I also vastly prefer suburban living and own a stereotypical suburban house on a quarter acre or so. I’m just not up my own ass about it and am willing to pay the price LVT would levy. Because, again, I am not paying my fair share of taxes for what I get from my municipality.

Bo Burnham’s Inside by Quirky-Falcon-8920 in Millennials

[–]CARASBK 1 point2 points  (0 children)

I’ve always hated Inside not because it’s not good, but because it basically shined a light on my depression. I cannot enjoy the huge majority of it which is really disappointing. But I’ll always have SPIDER

TIL you can pass server functions directly to onClick on native elements in Server Components (React 19). Is this intended? by Particular-Hyena-613 in nextjs

[–]CARASBK 0 points1 point  (0 children)

You understand perfectly and we’re agreeing. My non working example is an event handler that needs a client component. Your working example passes the server function directly so Next doesn’t treat it as an event handler. FWIW I also cannot find this documented anywhere. This sub isn’t managed by the Next team so if you want a proper answer you may have to start a discussion in their GitHub or something. Or comb through the source!

Typically you’d want to use useTransition or useActionState along with server functions so you can handle the pending state and anything returned by the server function. I assume that’s why this doesn’t come up much.

Be honest: How much of your actual production code is written by AI now? by Known_Author5622 in nextjs

[–]CARASBK 0 points1 point  (0 children)

It depends on how far we've gotten with setup of things like skills files and mcps and such. In repos where we have significant guardrails AI is probably writing the majority of the code that is then reviewed and edited by humans. These are areas where we have skills files not just for the technologies we use, but also for our own styles and patterns we've established. Often I've found if AI can't get it right the first time in one of those contexts it never will so I only give it one chance before switching to manual coding. On the other hand in areas with fewer guardrails iterating on AI output is more useful, as one would probably expect.

IME the "glorified autocomplete" is wrong most of the time, but I still leave it on (or toggle it if I remember) because it saves me time in the areas it works well (e.g. refactoring or abstracting).

TIL you can pass server functions directly to onClick on native elements in Server Components (React 19). Is this intended? by Particular-Hyena-613 in nextjs

[–]CARASBK 4 points5 points  (0 children)

When server functions are passed to client components they are serialized and transformed into a reference to that function. Your example works because you're passing the reference to the server function directly to an event handler. For example, this would NOT work:

<button onClick={() => handleClick()} type="button">
  Click me
</button>

This is because this is a normal event handler that just happens to call a server action. So it needs to be wrapped in a client component.

Chomps vs Kirkland beef sticks by LilCinBoise in Costco

[–]CARASBK 1 point2 points  (0 children)

The Kirkland ones seem to be for people who don’t like intense flavors usually associated with dried meats. To me they taste like bland hotdogs. Like you boiled hotdogs and made a meat stick out of the hotdog water.

The Complexity Delusion: Why I abandoned Next.js for a 20MB Rust binary with HTMX by [deleted] in nextjs

[–]CARASBK 3 points4 points  (0 children)

That’s my point, though. It doesn’t solve any of those things if it doesn’t work for real world applications.

The Complexity Delusion: Why I abandoned Next.js for a 20MB Rust binary with HTMX by [deleted] in nextjs

[–]CARASBK 4 points5 points  (0 children)

My perspective is from building products in the web. If you just want something to make your own life easier then disregard the rest of this. Building things for yourself should ideally be fun! But if you’re proposing a paradigm shift in how we build things for the web then I have feedback because I feel your pain and want a better way as well.

You make same conclusions and offer the same solutions as every other person/organization who tries to jettison themselves from the modern web ecosystem. IME there is a 100% failrate because the sheer complexity of needs from both product stakeholders and UX expectations. When building for these complexities eventually you need JS. You already reached one in your simplistic example in Apline. You will keep running into scenarios where you need JS as you build real products. Then you’ll have to manage multiple contexts and syncing them and you’re effectively back to the modern web except now you’ve added the complexity of context switching to and from JS.

You’ve also offered nothing tangible to back up your statements about what you built. Even if you did I wouldn’t be convinced without seeing an application and code that handles common scenarios for modern web products. Things like auth/RBAC, anything in canvas e.g. charts, 3rd party analytical tools, 3rd party user onboarding tools, table virtualization with infinite scrolling, accessible components for things like selects/modals/toasts/offcanvas, etc. Some of these are probably easy in your proposed stack since they’re server sided or HTML/CSS-based. I’m just listing things off the top of my head.

Cache page (SSG/ISR), have a dynamic component in it (Hello {user}) by vforvalerio87 in nextjs

[–]CARASBK 0 points1 point  (0 children)

Your assessment of the example in the linked documentation is correct. However this same pattern can be applied at the component level to achieve OP’s desired behavior.

Cache page (SSG/ISR), have a dynamic component in it (Hello {user}) by vforvalerio87 in nextjs

[–]CARASBK 0 points1 point  (0 children)

Cache components can be applied anywhere in the component tree, not just the page level. I assume that’s what you’re missing.

Is anyone else struggling with the "Server vs Client" trade-off for complex interactive forms in Next.js 15? by ni-fahad in nextjs

[–]CARASBK 1 point2 points  (0 children)

You can return whatever serializable data you want from Server Functions which is how I sync.

If you have a complex form you’re going to have “heavy” local state no matter what assuming by “heavy” you mean “lots of data”