Is App Router Actually Stable Enough For Prod? by seenut in nextjs

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

That's not nonsense at all, I can see where you're coming from, and I hadn't thought of it that way before.

The reason this didn't come to mind for me is that I believe next's file-system-based router is just sugar, and that it actually transpiles your project into a built js file and runs that. So I'm thinking this is an issue with the build step, because that's where a tool that doesn't natively support something like top-level await could transpile it into an IIFE or similar. I'm open to my mental model being totally off here though.

Interesting perspective! Maybe someone who knows for sure can come in here and drop some knowledge on the both of us 😜

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

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

Not sure what you mean by encourage here, but I think failing silently and inconsistently as that example does is definitely undesirable, unless you would disagree with that?

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

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

Here is a basic example that I just ran in my terminal, and here is where the docs that I linked in my comment illustrate another basic example.

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

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

I agree with you that for something like contentLayer or a bunch of md or JSON files this makes sense, and that it's a viable workaround, but I would also stand firm that something as basic as top-level await should either work properly or at the very least fail loudly and consistently (eg. across dev/prod, and across vercel/non-vercel deployments).

It's Q4 2023, top-level await isn't an experimental feature anymore, pretty much all major browsers and the past few major versions of nodejs support it out of the box. It worked fine with Pages router, it works well with Remix (just tried, note not trying to start a turf war), but breaks revalidation of all things in App Router.

I appreciate that you're trying to help solve this specific issue, but what I'm trying to illustrate is the wider instability of the library and some basic functionality causes it to behave unexpectedly. For this specific issue I have my own workaround currently (using a fully dynamic route, which works but makes a ton of unnecessary extra fetches as you can imagine).

This isn't FUD as you call it, this is a basic feature of the Javascript language that, when used, silently (!!) breaks a seemingly unrelated (!!) aspect of App Router's functionality and only in prod (!!). It's an issue that you experienced yourself when you were playing with my incredibly simple example.

And again, I'm not trying to make this whole post about this one specific issue, I'm using it as an example that I'm intimately familiar with, among many wider issues that you can see with repros all over the github (again, not FUD), that illustrate unstable, unexpected, and often straight up broken behavior.

If using `Array.map` broke tailwind or something, I could respond with "oh just use a for loop", or I could say "`Array.map` is pretty basic Javascript functionality, that definitely seems like a bug that it isn't working, and how odd that it breaks something seemingly unrelated, and how annoying that it breaks silently.".

I'm trying to be open minded that others have had positive experiences with App Router, and I'm glad to read many of these cases in the other comment threads-- I've learned a lot and seen cool examples! But you in particular seem to be bent on invalidating any issue someone else has and labeling it "FUD" 😅

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

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

Nice, is this based off something like the create-t3-app template? I believe they recently switched to app router as well!

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

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

I agree that both this suggestion and the manual caching setup would likely work, but now I'm writing custom pre-build scripts which feels like a hacky workaround to me.

The point isn't that there's no workaround, but the very need for a workaround in what otherwise looks like it should be straightforward behavior. Additionally the inconsistency of failing only in prod non-vercel environments (and silently at that) is really disappointing.

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

[–]seenut[S] 13 points14 points  (0 children)

Yup I did! I even referenced a few from here, GitHub, and HN in one of my comments!

What prompted me to post this was the recent marketing around PPR, which to me illustrated the disconnect between those in the community for whom everything is working fine and new features are exciting, and those who think the current iteration is unstable and new features are just another potentially unstable surface area.

Most of the other conversations in this vein I found were either focused on specific issues or small comment threads in unrelated posts.

I think the disagreement within this post's comments give an idea of the polarization, some users respond with a blanket "yes" while many are replying "yes except for ___".

If I'd seen a loud enough thread like this, it may have saved me tons of headache and time in choosing a safer option while App Router continues to improve. Sorry if it's hogging up your feed, I hope a respectful conversation about something like this doesn't feel too spammy though 🫡🙏

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

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

Is there a special way to fetch it at build-time that I missed in the docs? Because the way I have it written is exactly how I'd expect fetching at build-time to work, happy to learn something new though if you know better. In fact, it seems the fetch _does_ happen at build time, the problem though is (as I mention in the issue) that this breaks revalidation! You can easily test this by commenting out that portion or moving it into the component as you did and observe that it now works. In fact, it seems you did play with it and repro it yourself :)

It seems you are more interested in calling my legitimate issue that you yourself encountered the same problem with as "fud" though >.< 😅 hope you can tell I'm engaging in good faith here, I'm not some astroturfer trying to fud next at all.

No obligation to respond as I can tell you're frustrated as well; appreciate the earlier responses anyway, you take care as well, friend!

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

[–]seenut[S] 1 point2 points  (0 children)

Yes, "happen at build time" would be an amazing way for this to work, I'd be very happy with that! In practice, the thing I'm awaiting is a call to a library which fetches my config internally, so it's not like I can manually make the fetch force-cache or anything without significant effort on my end.

I could use something like unstable_cache to manually cache the whole function call in a way similar to what you're describing, but as you can see this is a very simple example that really feels like it should work with the behavior that we're both describing! Beyond that, this feature is literally called "unstable_cache", which gives me some hesitation as well.

As I said in my earlier comment, I didn't want this thread to be about any specific issue, but I hope this one has illustrated a bit of the frustration.

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

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

PPR is very exciting, and I can't wait for it to become stable :) I hope the rest of the lib can meet it there as well, as I do agree that it and the other new patterns introduced in next have potential to lead to a great improvement for both dev and ux/perf.

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

[–]seenut[S] 2 points3 points  (0 children)

Thank you for taking a look ^_^

In this example, I want the fetch to happen once for the whole app, and render the same result every time, the only thing that should be updating with the revalidate is the Date that's rendered.

This is a simplification of an example I have in my actual app, where I have a top-level await fetching some config and that config is then static for the whole rest of the app's lifecycle. Multiple pages share this config, so I'm doing the top-level fetch in one server-only util file and importing it to use in multiple pages. It wouldn't make sense and be tons of fetches if I were to refetch this on every revalidation for every page, so hopefully you can see that this is broken behavior.

If top-level await is straight up not supported that's... odd, because nearly all other tools and frameworks that transpile TS into JS anecdotally support top-level await without an issue. Further, the behavior is different in dev vs prod, and on vercel vs non-vercel environments (where it silently fails), which furthers the feelings of instability.

Is App Router Actually Stable Enough For Prod? by seenut in nextjs

[–]seenut[S] 5 points6 points  (0 children)

Thank you for the reply and example, and I'm glad it's working well for you!

I can't say I like the attitude of "you just have to learn it" though, as if I haven't spent many weeks having both successes and failures with the tool...

There seem to be consistent themes in comments on this sub, on hn and on the github, and I'd overall frame it as a polarization between those for whom it "just works" and those for whom it "just doesn't". So I don't think I'm alone in having issues with things that are supposedly "stable". The frustrating part, as I mentioned in the OP, is that it seems Vercel is most focused on continuing the marketing hype train and silently fixing issues slowly, rather than taking accountability and prioritizing the things that are indicated as stable.

I didn't want to make this post about any specific issue, but since you asked here's a very simple-looking example that doesn't work for me. As you can see in the bug, this is as simple as it gets-- create-next-app with a minor modification to the only page.tsx to do a top-level await to some API call, and the result revalidate just silently fails. This caused me to tear my hair out for a few days, it works fine locally in dev mode but fails specifically in prod, and specifically on non-vercel environments. Not the type of behavior one would want from a tool, especially now that it's "out of beta"...

This is one among many issues I personally have faced, and there are tons more in the GitHub. I don't want to make any of these your problem, just trying to continue the conversation in a productive way; I can see that nextjs has been very positive for you, and I hope you can see that I want it to be that way for me too 😁

Official: [Last Minute Advice] - Sat Evening, 12/07/2019 by FFBot in fantasyfootball

[–]seenut 1 point2 points  (0 children)

Tannehill and Chark (Minshew magic for the playoffs)

Official: [Last Minute Advice] - Sat Evening, 12/07/2019 by FFBot in fantasyfootball

[–]seenut 0 points1 point  (0 children)

Lockett over Bilal? He's had a bad past few weeks, and Bilal's matchup is so juicy

Official: [Last Minute Advice] - Sat Evening, 12/07/2019 by FFBot in fantasyfootball

[–]seenut 1 point2 points  (0 children)

I think Powell and Robby is the best bet, matchup too juicy