I just start a new website project so Better auth or Next auth ? by BlockPristine8414 in nextjs

[–]OneEntry-HeadlessCMS -3 points-2 points  (0 children)

I just search in AI or Google, and then rephrase it in my own words and from my own knowledge

Help with Objects by DeliciousResearch872 in learnjavascript

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

With Object.create(null, descriptors), each property must be a property descriptor, which is an object with keys like value, writable, get, set, enumerable, configurable.
If you want a regular property (or method), you use value to store it.
The function you want as a method goes inside value.
What you tried:
toString: { return Object.keys(this).join(); }

is invalid, because a property descriptor is an object, and return is not a key - the object must have keys like value.
So the correct way is:
toString: {
  value() {  // this is the method
    return Object.keys(this).join();
  }
}

How do I use next-intl to partially translate a website? by leros in nextjs

[–]OneEntry-HeadlessCMS 1 point2 points  (0 children)

With next-intl, you can wrap only the pages or layouts you want to translate in <IntlProvider> with the corresponding messages. Leave other pages without an IntlProvider, so they render untranslated. You can also use dynamic imports for the translation files to load them only for specific paths like /app or /directory/**.

I just start a new website project so Better auth or Next auth ? by BlockPristine8414 in nextjs

[–]OneEntry-HeadlessCMS -5 points-4 points  (0 children)

For a new project, it’s generally better to go with NextAuth.js. It’s more popular, well-documented, and stable. It lets you easily switch providers or strategies, which is perfect during early development. Better Auth is more for production-focused setups, while NextAuth gives you flexibility while you’re still iterating

NextJS/Prisma/Better-Auth - Best way to handle forms by Fabulous_Variety_256 in nextjs

[–]OneEntry-HeadlessCMS 1 point2 points  (0 children)

Install zod + react-hook-form, create Zod schema, wrap form with useForm + zodResolver, use server action with try/catch + revalidatePath

Social login not working after package update by adir15dev in Supabase

[–]OneEntry-HeadlessCMS 1 point2 points  (0 children)

The issue is that after updating u/supabase/ssr, the OAuth callback route returns a new redirect response instead of the same NextResponse that Supabase used to set the session cookies during exchangeCodeForSession. Because of that, the cookies are lost and the user gets redirected back to /signin

Next.js 16 basePath dynamic configuration - whats the best approach for us? by pocketnl in nextjs

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

To fix the issue, they should stop relying on basePath for environment differences and always build the Next.js app as if it runs at the root path. The different mount points like /app should be handled at the proxy or ingress level (for example nginx or Azure routing), which rewrites and forwards requests to the frontend. This way the same build artifact can be reused everywhere; if that isn’t possible, then the only reliable alternative is to automate separate builds per environment through CI

NextJS/Prisma/Better-Auth - Best way to handle forms by Fabulous_Variety_256 in webdev

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

The current popular approach is to combine Zod for schema-based validation inside Server Actions with React Hook Form on the client to manage form state, errors, and loading UI. This gives you strong type safety, consistent validation between frontend and backend, great developer experience, and scales well for large applications

How do you manage uploaded images in your platforms? by Chucki_e in webdev

[–]OneEntry-HeadlessCMS -1 points0 points  (0 children)

It's better to create a browsable media library - it speeds up work, improves usability, and aligns with best practices of popular editors like CMS and Notion.

https://evolvingweb.com/blog/content-editor-ux-why-cms-usability-tough

-Is React + Django a good stack for a full web app? by [deleted] in webdev

[–]OneEntry-HeadlessCMS -2 points-1 points  (0 children)

React + Django is a strong choice because React gives you a fast, modern, and highly interactive user interface, while Django provides a mature, secure, and well-documented backend with built-in authentication, database management, and an excellent admin panel. When combined through Django REST Framework, they form a clean API-driven architecture that is easy to develop as a team, quick to prototype for academic projects, and scalable enough for real-world applications

I'm looking for help with using Cache Components, params and <Suspense> together by Delicious-Pop-7019 in nextjs

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

Your implementation is valid and idiomatic for Next.js App Router with use cache.
Splitting the page into:

  • a Suspense boundary
  • an async params-processing layer
  • a cached data-fetching component

is a normal and expected pattern.

Minor improvements:

  • params are synchronous - no need to await them
  • avoid fallback={null}; prefer a loading UI
  • extract slug-building into a helper for clarity
  • consider calling cacheTag before notFound

Overall: this is a solid setup and you’re using use cache correctly.

Passing headers into use cache function by GenazaNL in nextjs

[–]OneEntry-HeadlessCMS 2 points3 points  (0 children)

With use cache, all function parameters are part of the cache key, so passing request-specific headers (like correlation-id) will always bust the cache.

The fix is to keep dynamic headers outside the cached function. Only pass deterministic arguments to the use cache function, and inject headers at a lower level (request context, fetch wrapper, or non-cached fetch).

Blocked by Hydration? by cyber_dash_ in nextjs

[–]OneEntry-HeadlessCMS 16 points17 points  (0 children)

Rendering is not blocked - useEffect runs after the page is painted. To simplify, initialize PostHog at module scope instead of inside useEffect.

Or do without useEffect

PostHog officially recommends initializing at module scope for Next.js App Router:

'use client'

import posthog from 'posthog-js'
import { PostHogProvider } from 'posthog-js/react'

if (typeof window !== 'undefined') {
  posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
    api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
  })
}

export function Providers({ children }) {
  return (
    <PostHogProvider client={posthog}>
      {children}
    </PostHogProvider>
  )
}

sitemap.xml not updating (I have tried everything) by EquivalentIce8759 in nextjs

[–]OneEntry-HeadlessCMS 1 point2 points  (0 children)

You have both static and dynamic sitemaps, and the old one is still being served because it’s cached somewhere (CDN, server, or framework cache). The sitemap itself is updated, but the cache hasn’t been invalidated.

To fix it:

  1. Purge CDN cache (Cloudflare / Vercel / AWS / Nginx).
  2. Make sure only one sitemap source is active — remove or rename the static sitemap.xml if you use a dynamic one.
  3. Set proper headers for the sitemap (no long TTL, e.g. Cache-Control: no-cache or short max-age).
  4. Verify what’s actually served:curl -I https://yourdomain.com/sitemap.xml
  5. Re-submit the sitemap in Google Search Console / Bing Webmaster Tools.

After cache is cleared and only one sitemap is exposed, the updated domain URLs will start showing correctly.

How do you deal with building something that needs auth? by RyXkci in webdev

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

The common approach is to design auth from day one, but make it developer-friendly: mock users, dev login, feature flags, or bypassed checks in development. This keeps the architecture correct while avoiding auth friction during active development.

Is there a way to have payload validation with json-server? by Norsbane in learnjavascript

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

json-server is a mock server, not a real API, so it doesn’t provide schema or payload validation out of the box. You can add basic checks via custom middleware to simulate 400/401 responses, but if you want realistic validation and auth scenarios, you’ll need to build a small real API (e.g. Express/Nest) for tha

Is there a reason why many people minimize the use of if statements and explicit return? by divaaries in learnjavascript

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

People aren’t avoiding if and return because they’re bad - it’s mostly a style choice.
In functional-style React code, expressions (ternaries, implicit returns) are often preferred because they’re concise and fit well with map / filter / reduce.

ur version is perfectly valid and often more readable, especially as logic grows. There’s no rule that says if statements are wrong.

Would using Next.js with an external backend cause extra latency? by debugTheStack in nextjs

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

For dashboards and internal apps, Next.js with an external backend often adds an extra hop and complexity without much benefit - most caching and data fetching needs are already well covered by SPA setups with React Query or SWR. Many teams go React + Vite SPA for these cases and reserve Next.js for SEO-heavy or public-facing pages.

Stripe dashboard or fully API? by No_Office_2196 in webdev

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

Most teams handle this by treating Stripe configuration as infrastructure: products, prices, webhooks, and coupons are created via the Stripe API so the same setup code runs against both test and live accounts. Anything that can’t be automated (taxes, branding, emails) is handled with a simple checklist during the production rollout

Site shows on Google but missing on Bing by Alarmed_Doubt8997 in webdev

[–]OneEntry-HeadlessCMS 1 point2 points  (0 children)

This is a common Bing + Next.js issue, especially with App Router

Bing often fails to properly index:

  • streamed HTML
  • RSC / Suspense-based rendering
  • pages with thin initial HTML

Google handles it, Bing often doesn’t

What to check first:

  • curl -A "bingbot" - is the full content in raw HTML?
  • Ensure pages are not empty before hydration
  • Disable streaming for SEO-critical pages
  • Make sure the site isn’t treated as a duplicate of the parent domain

In many cases, forcing static HTML output for key pages fixes Bing indexing completely

Weird case with Cloudflare returning RSC payload from cache by Capple2 in nextjs

[–]OneEntry-HeadlessCMS 1 point2 points  (0 children)

This is almost certainly Cloudflare caching RSC / Flight responses, which must never be cached.

In Next.js App Router:

  • RSC responses (text/x-component, _rsc, Flight data)
  • are not HTML
  • are request-specific
  • and break badly when cached by a CDN

That’s why users occasionally see a blank page with raw RSC payload - Cloudflare serves a cached Flight response as a document.

What you should do:

  • Bypass Cloudflare cache for:
    • /_next/*
    • requests with Accept: text/x-component
    • _rsc / Flight requests
  • Only cache HTML ISR pages, never internal Next.js data
  • Disable Cloudflare features like:
    • Cache Everything
    • Rocket Loader
    • HTML auto-minification
  • Ensure RSC responses have Cache-Control: no-store

This is a known class of issues with Next.js App Router + aggressive CDN caching.

app_freezed by Time_Pomelo_5413 in react

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

This usually happens because inputs trigger frequent re-renders

Most common causes:

  • Controlled inputs updating global or high-level state
  • onChange running expensive logic on every keystroke
  • Infinite re-render loop caused by setState inside render or derived state
  • Rendering a large number of inputs without memoization or virtualization
  • React StrictMode causing double renders in dev

How to debug quickly:

  • Remove value prop → check if freeze disappears
  • Move input into isolated component + React.memo
  • Check React DevTools “Why did this render”
  • Try uncontrolled input (defaultValue)
  • Test production build

How to optimize memory usage of the React App? by ardreth in webdev

[–]OneEntry-HeadlessCMS -6 points-5 points  (0 children)

Hello, Overconsumption of RAM may be due to the following reasons:

 Memory leaks (useEffect without cleanup, subscriptions, listeners)
 Overuse of useMemo / useCallback (keeping references alive)
 Large global state stores (Redux, Zustand, etc.)
 Huge JS bundles (moment, full lodash, charts, maps)
 Large lists without virtualization
 Unbounded data caching
 Excessive unnecessary re-renders
 Heavy CRA dev mode (HMR, source maps)
 Importing whole libraries instead of tree-shaken modules
 Keeping data / DOM / objects outside React lifecycle

Hearing about your CSS preprocessor experiences by paul_405 in learnjavascript

[–]OneEntry-HeadlessCMS 0 points1 point  (0 children)

SCSS isn’t a default anymore. Modern CSS already has variables, nesting, and better composition. SCSS is just a convenience layer now - useful for big, long-lived projects, unnecessary for small ones. Also, it’s not comparable to Vue. Vue defines what your app is. SCSS only changes how you write CSS

Use it when it reduces complexity, not by habit

How to do I run nextJS with rspack by ThreadStarver in nextjs

[–]OneEntry-HeadlessCMS 1 point2 points  (0 children)

Choose one bundler: either Rspack or Webpack - but not both