1. 20 Mar, 2024 1 commit
  2. 19 Mar, 2024 4 commits
  3. 18 Mar, 2024 8 commits
  4. 06 Mar, 2024 6 commits
  5. 04 Mar, 2024 7 commits
    • JJ Kasper's avatar
      v14.1.2 · f564deef
      JJ Kasper authored
      f564deef
    • Jiachi Liu's avatar
      Fix sitemap generateSitemaps support for string id (#61088) · a85519e7
      Jiachi Liu authored
      Fixes the string id that broken when sitemap is optimized to static
      route.
      
      When sitemap is optimized to static route in production, the route
      argument is changed from `[[...__metadata_id__]]` to
      `[__metadata_id__]`, so the type of it is also changed from array to
      string that should reflect in the loader code.
      
      Fixes #60894
      Closes NEXT-2154
      a85519e7
    • Abhinay Pandey's avatar
      Fix: generateSitemaps in production giving 404 (#62212) · 0a2d7754
      Abhinay Pandey authored
      generateSitemaps function returns a 404 for /sitemap/[id].xml in
      production
      
      While finding the correct sitemap partition from the array, we check the
      param against the id. Which works in dev because id and param are both
      without trailing .xml. But it fails in production as param has a
      trailing .xml (/sitemap/[id] works in production because it falls back
      to dynamic loading and param and id are both without .xml)
      
      If we are in production environment, check the id with a trailing .xml
      because that's whats returned from generateStaticParams, an array of
      __metadata_id__ with trailing .xml
      
      Fixes #61969
      
      ---------
      Co-authored-by: 's avatarJiachi Liu <inbox@huozhi.im>
      0a2d7754
    • Jiachi Liu's avatar
      Fix redirect under suspense boundary with basePath (#62597) · 400b57cf
      Jiachi Liu authored
      Fixes `redirect()` call under suspense boundary, redirect url should
      include the `basePath` in the url.
      
      `redirect()` under suspense boundaries will go through server html
      insertion, which is being used every time by suspense boundary resolved,
      new errors will triggered from SSR streaming. It was missing before.
      
      Fixes NEXT-2615
      Fixes #62407
      400b57cf
    • Shu Ding's avatar
      fix: Add stricter check for "use server" exports (#62821) · 714020fb
      Shu Ding authored
      As mentioned in the new-added error messages, and the [linked
      resources](https://react.dev/reference/react/use-server#:~:text=Because%20the%20underlying%20network%20calls%20are%20always%20asynchronous%2C%20%27use%20server%27%20can%20only%20be%20used%20on%20async%20functions.):
      
      > Because the underlying network calls are always asynchronous, 'use
      server' can only be used on async functions.
      > https://react.dev/reference/react/use-server
      
      It's a requirement that only async functions are allowed to be exported
      and annotated with `'use server'`. Currently, we already have compiler
      check so this will already error:
      
      ```js
      'use server'
      
      export function foo () {} // missing async
      ```
      
      However, since exported values can be very dynamic the compiler can't
      catch all mistakes like that. We also have a runtime check for all
      exports in a `'use server'` function, but it only covers `typeof value
      === 'function'`.
      
      This PR adds a stricter check for "use server" annotated values to also
      make sure they're async functions (`value.constructor.name ===
      'AsyncFunction'`).
      
      That said, there are still cases like synchronously returning a promise
      to make a function "async", but it's still very different by definition.
      For example:
      
      ```js
      const f = async () => { throw 1; return 1 }
      const g = () => { throw 1; return Promise.resolve(1) }
      ```
      
      Where `g()` can be synchronously caught (`try { g() } catch {}`) but
      `f()` can't even if they have the same types. If we allow `g` to be a
      Server Action, this behavior is no longer always true but depending on
      where it's called (server or client).
      
      Closes #62727.
      714020fb
    • Zack Tanner's avatar
      ensure server action errors notify rejection handlers (#61588) · dbab205b
      Zack Tanner authored
      ### What
      When attaching a rejection listener to a server action promise, in the case of network errors, the rejection handler would be skipped and it'd throw an error that crashes the application.
      
      ### Why
      When we refactored these reducers to no longer suspend, it caused the rejection handling logic we have to no longer make sense. In this case we're working with a native promise that won't have a `status` property, so we'd re-throw the error and not call `reject`. 
      
      ### How
      This removes the special status handling logic and makes the rejection handler always call `reject` with the error. This will either be handled by user code or let the error bubble to an error boundary. 
      
      I also cleaned up some mutable code that is no longer needed now that these reducers aren't replayed. 
      
      Closes NEXT-1715
      Closes NEXT-2323
      Fixes #58638
      dbab205b
    • Zack Tanner's avatar
      make router restore action resilient to a missing tree (#62098) · a70ae409
      Zack Tanner authored
      Following an anchor link to a hash param, and then attempting to use
      `history.pushState` or `history.replaceState`, would result in an MPA
      navigation to the targeted URL.
      
      In #61822, a guard was added to prevent calling `ACTION_RESTORE` with a
      missing tree, to match other call-sites where we do the same. This was
      to prevent the app from crashing in the case where app router internals
      weren't available in the history state. The original assumption was that
      this is a rare / unlikely edge case. However the above scenario is a
      very probable case where this can happen, and triggering an MPA
      navigation isn't ideal.
      
      This updates `ACTION_RESTORE` to be resilient to an undefined router
      state tree. When this happens, we'll still trigger the restore action to
      sync params, but use the existing flight router state.
      
      Closes NEXT-2502
      a70ae409
  6. 02 Mar, 2024 3 commits
  7. 29 Feb, 2024 5 commits
  8. 28 Feb, 2024 6 commits