Skip to content

Commit

Permalink
adjust err handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsfletch committed Oct 7, 2024
1 parent 860b6cf commit 633aaa7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/custom-components/src/app/(payload)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import configPromise from '@payload-config'
import config from '@payload-config'
import '@payloadcms/next/css'
import { RootLayout } from '@payloadcms/next/layouts'
import React from 'react'
Expand All @@ -13,7 +13,7 @@ type Args = {
}

const Layout = ({ children }: Args) => (
<RootLayout config={configPromise} importMap={importMap}>
<RootLayout config={config} importMap={importMap}>
{children}
</RootLayout>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import configPromise from '@payload-config'
import config from '@payload-config'
import '@payloadcms/next/css'
import { RootLayout } from '@payloadcms/next/layouts'
import React from 'react'
Expand All @@ -13,7 +13,7 @@ type Args = {
}

const Layout = ({ children }: Args) => (
<RootLayout config={configPromise} importMap={importMap}>
<RootLayout config={config} importMap={importMap}>
{children}
</RootLayout>
)
Expand Down
10 changes: 4 additions & 6 deletions packages/ui/src/providers/ServerFunctions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,12 @@ export const ServerFunctionsProvider: React.FC<{
args: rest,
})) as ReturnType<typeof buildFormState> // TODO: infer this type when `strictNullChecks` is enabled

if (signal?.aborted) {
throw new Error('Request was aborted, ignoring result')
if (!signal?.aborted) {
return result
}

return result
}
} catch (error) {
console.error(error) // eslint-disable-line no-console
} catch (_err) {
// swallow error
}

return { state: args.formState }
Expand Down
2 changes: 0 additions & 2 deletions templates/_template/src/app/(payload)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import type { ServerFunctionClient } from 'payload'

import config from '@payload-config'
import '@payloadcms/next/css'
import { RootLayout } from '@payloadcms/next/layouts'
Expand Down

0 comments on commit 633aaa7

Please sign in to comment.