Commit Graph

12030 Commits

Author SHA1 Message Date
Alessio Gravili
13fc94dc4d chore: upgrade to TypeScript 5.7, ensure tsconfig targed and lib properties match the APIs we support (#9473)
TS 5.7 added support for ES2024. By keeping target: “esnext”, we would
have accidentally set our minimum supported ES version to ES2024.

This sets it to ES2022, which is the version supported by Node 18
2024-11-23 16:35:27 -07:00
Paul
23d54a76c1 fix(templates): website template firefox logo fix and images fix on vercel (#9459)
Fixes logo not showing up on firefox and images not loading properly
when hosting with Vercel
2024-11-22 23:53:06 +00:00
Elliot DeNolf
f155e00f00 docs: proper readme (#9458)
Updated `packages/payload` README by copying down the top-level README.
We incorrectly thought this was some sort of caching issue on NPM.

Closes #9452
2024-11-22 18:01:50 -05:00
Paul
09abebd58c fix(templates): vercel website template payload config regression (#9455) 2024-11-22 20:18:04 +00:00
Paul
90fedbc16b fix(templates): fixes imports in website template from @payloadcms/ui to be direct (#9451) 2024-11-22 19:08:38 +00:00
Paul
322738fca3 chore(templates): copy over improvements to the vercel website template and add vscode debug config (#9450)
Copied over the improvements from the website template into the vercel
website template.

Add vscode debug config to both templates.
2024-11-22 18:42:28 +00:00
Paul
be8cd7f4d9 feat(templates): website optimisations for image sizes and loading (#9447)
Adds defaultPopulate on pages and posts
Further optimises images and fetching staticParams
2024-11-22 18:21:56 +00:00
Jacob Fletcher
b9d02aa3a8 chore: removes leftover references to beta (#9445)
Still a few leftover references to beta in various JSDocs and other
places.
2024-11-22 13:19:20 -05:00
Elliot DeNolf
65ac739da9 chore(release): v3.1.0 [skip ci] v3.1.0 2024-11-22 11:54:08 -05:00
Jacob Fletcher
ae6c71b3b5 fix(live-preview): client-side live preview cannot clear all array rows (#9439)
When using Client-side Live Preview, array fields are unable to clear
all their rows. This is because `reduceFieldsToValues` sets the array's
value as 0 within form-state when no rows exist, as opposed to an empty
array as one might expect. For now, we can simply handle this data shape
within Live Preview's merge logic. In the future we may want to take to
consider changing the behavior of empty arrays within form-state itself.
2024-11-22 16:43:48 +00:00
Riley Pearce
27acdaee7a fix(ui): add disabled attribute to blocks drawer toggler (#9424)
### What?

When `update` access control is set to `false`, the blocks drawer can
still be accessed. Blocks still cannot be saved to the document, making
this more of a QoL improvement.

### Why?

The blocks `DrawerToggler` is missing the `disabled` attribute.

### How?

Adding the `disabled` attribute to the blocks `DrawerToggler`.

### Reproduction steps

https://github.com/rilrom/payload/tree/issue/disabled-add-block-button

1. Navigate to the posts collection.
2. Click the 'Add blocks' button.
3. Blocks can be selected (however they are still readonly in the
document and cannot be saved).

### Recordings

Before


https://github.com/user-attachments/assets/da12829d-5b27-4da9-bbd1-067d679a89ba

After


https://github.com/user-attachments/assets/67166477-b83a-4495-98ae-2d272542103b
2024-11-22 08:59:38 -07:00
Jessica Chowdhury
fb3242df0a feat: add skip and force accept flags to migration commands (#8843)
1. Adds flag `--skip-empty` to `migrate:create` to bypass the empty
migration file prompt.
    - Blank migration file will not be created if this flag is passed.
3. Adds flag `--force-accept-warning` to `migrate:fresh` to bypass the
drop database prompt
2024-11-22 10:37:54 -05:00
Germán Jabloñski
251c4c30d7 chore: fix path and samples for lexical-mdx tests (#9433)
Later we could add better examples that test complex use cases, but at
least this allows the code to compile.
2024-11-22 14:55:39 +00:00
Alessio Gravili
9e31e17e31 feat(richtext-lexical): more powerful custom Block RSCs, improved selection handling (#9422)
Now, custom Lexical block & inline block components are re-rendered if
the fields drawer is saved. This ensures that RSCs receive the updated
values, without having to resort to a client component that utilizes the
`useForm` hook.

Additionally, this PRs fixes the lexical selection jumping around after
opening a Block or InlineBlock drawer and clicking inside of it.
2024-11-22 02:34:29 +00:00
Alessio Gravili
b9cc4d4083 fix(richtext-lexical): error when changing block collapsed state in rare cases (#9421) 2024-11-22 01:13:03 +00:00
Alessio Gravili
a891e98bfc fix(richtext-lexical): slash menu from + button did not trigger item select action (#9420)
Fixes a bug I introduced through
https://github.com/payloadcms/payload/pull/9396 and adds an e2e test
2024-11-22 00:48:45 +00:00
Alessio Gravili
38de760ca5 feat(richtext-lexical): allow customizing maxActiveItems for toolbar groups (#9417)
Previously, they were hardcoded to 1. This is useful for lexical toolbar
groups where multiple items can be active at the same time.
2024-11-21 23:53:29 +00:00
Paul
18b139b9de fix(templates): website template breaking change by renaming hero image to jpg (#9416) 2024-11-21 21:42:29 +00:00
Alessio Gravili
3b68671348 feat(richtext-lexical): export lexical drawer hooks (#9415) 2024-11-21 21:12:17 +00:00
Sasha
91dcf6dc08 fix: invalid payload.collections type (#9414)
### What?
`payload.collections` was improperly typed.
This doesn't seem to work: (the type is `{}`)
```
collections: {
  [slug: CollectionSlug]: Collection
} = {}
```
<img width="794" alt="image"
src="https://github.com/user-attachments/assets/7daceab9-8f43-433b-9201-1bf8c48fb8ca">

However, this does:
```ts
collections: Record<CollectionSlug, Collection> = {}
```
<img width="540" alt="image"
src="https://github.com/user-attachments/assets/e37d595d-f5b4-4b02-b190-bb5d4063787d">


Additionally, the same fix applied to `Permissions`,
`PolymorphicUploadField['admin']['sortOptions']`,
`PolymorphicRelationshipField['admin']['sortOptions']`
2024-11-21 22:58:04 +02:00
Jacob Fletcher
f5683b0a64 fix(next): threads server props to custom providers (#9412)
When defining custom providers as server components, they currently do
not receive any of the server props that custom components expect to
receive, like `payload`, `i18n`, `user`, and so on.
2024-11-21 15:44:32 -05:00
Paul
2036a566fd feat(templates): update website styles and new home hero image (#9413) 2024-11-21 20:39:56 +00:00
Friggo
0b4e5a6ece chore(templates): updates github urls in seed data (#9376)
Update the GitHub URLs to website template to point to main instead of beta
2024-11-21 15:35:07 -05:00
Alessio Gravili
e3866c4035 fix(ui): stale server components when rows are moved (#9410)
We need to trigger server component re-rendering for moving rows, just
like we do for adding or deleting rows.

Video of the issue:


https://github.com/user-attachments/assets/32fb31c5-f304-4082-8028-59a6ad723fbe
2024-11-21 20:14:57 +00:00
Patrik
f338c5c40c chore(examples): updates custom-components,email & multi-tenant to latest payload version (#9411)
### What?

Although the following examples:

- `custom-components`
- `email`
- `multi-tenant`

were recently migrated to 3.0 - they were still using the latest `beta`
version instead of latest payload (i.e `3.0`)
2024-11-21 14:56:34 -05:00
Jacob Fletcher
118b442883 docs: custom server providers and filter components (#9303)
- Removes mention of custom providers needing to be client components
- Documents custom field `Filter` components
- Adjusts language and other misc. grammar and spelling
2024-11-21 14:25:37 -05:00
Jarrod Flesch
ee1a91ee7c fix: unable to load documents with non-standard ids (#9407)
### What?
Non-standard ids caused an issue when finding the document on the
server.

This is an odd regression, in 2.0 we were fetching the document on the
client so the request would handle decoding the url. Now we are fetching
the document on the server and need to do this manually when reading id
from route params.

### Why?
The slug pulled out of the url for an id of `id 1` would equate to
`id%201` which would fail in the `payload.find` call since there is not
an id stored as `id%201` but instead `id 1`.

### How?
Wherever we are calling payload.find in the views and querying by `id`
it gets ran through a helper function that decodes it properly.

Fixes #9373
2024-11-21 14:16:01 -05:00
Patrik
304ecd29ac docs: removes public demo references (#9408)
### What?

Removes all references to the `public-demo` from the docs
2024-11-21 14:09:08 -05:00
Jarrod Flesch
204b08bc25 chore: update issue templates (#9409)
Removes mentions of `beta` in issue templates now that 3.0 has been
released.
2024-11-21 13:56:16 -05:00
Sasha
f2205d1694 fix(next): next@15.0.3 compatibillity for turbopack warnings patch (#9341)
Added patch to `withPayload` for hiding turbopack external deps warnings
from this PR https://github.com/payloadcms/payload/pull/9147 didn't work
on `next@15.0.3`, now it works on both `15.0.0` and `15.0.3`.
2024-11-21 20:46:09 +02:00
Germán Jabloñski
082e546159 chore: fix test/lexical-mdx imports (#9405)
missing from #9229
2024-11-21 18:38:16 +00:00
Jarrod Flesch
d7ad1733f2 chore: type getViewFromConfig, add viewActions to serverProps (#9404)
### What?
`viewActions` are not easily accessible in custom views.

### Why?
We extract view actions when we call `getViewFromConfig`, but never pass
them to the custom views.

### How?
Properly types return type for serverProps inside `getViewFromConfig`
and adds viewActions to serverProps so they are spread into props when
we build the custom view components.

Now custom server views will get the viewActions as a prop.

Fixes #9338
2024-11-21 11:58:05 -05:00
Sasha
d499de1e0f fix(db-postgres): joins with versions and hasMany relationship (#9370)
Fixes errors when having joins with versions +drafts on `hasMany: true`
relationships.
Removes `joinQuery` overhead if we don't need it for the current
operation. Right now, in all adapters we support joins only for `find`,
`findOne`, and `queryDrafts`.


Fixes https://github.com/payloadcms/payload/issues/9369
2024-11-21 10:42:05 -05:00
Alessio Gravili
3d0424bc77 fix(richtext-lexical): slash menu query doesn't disappear after selecting slash menu item (#9396)
This happened only for certain slash menu items like inline blocks.

Fixes https://github.com/payloadcms/payload/issues/9326
2024-11-21 06:15:22 +00:00
Germán Jabloñski
0960290558 fix(richtext-lexical): preserve indent and text-align when converting Lexical <-> HTML (#9165)
Fixes #5146 

This had been solved in https://github.com/facebook/lexical/pull/6693
but we are using another serialization. I open
https://github.com/payloadcms/payload/discussions/9166 to discuss/track
how we can improve this in the future
2024-11-20 22:24:45 -07:00
Alessio Gravili
48b60fc905 chore(richtext-lexical): enable strict: true (#9394)
Thanks to @GermanJablo for doing most of the work by enabling
`noImplicitAny` and `strictNullChecks` in previous PRs
2024-11-21 04:19:18 +00:00
Alessio Gravili
90e37fe78d fix(ui): error when collapsing sidebar groups (#9393)
Fixes
https://discord.com/channels/967097582721572934/1308933812914229368/1308933812914229368

![CleanShot 2024-11-20 at 19 04
45@2x](https://github.com/user-attachments/assets/3c2c8054-9d09-4090-adf8-57aef8635baf)
2024-11-21 02:17:45 +00:00
Alessio Gravili
9470f9b01f fix: error when opening admin panel without any permissions (#9392)
We were getting the following error when opening the create first user
page, as sanitizedPermissions is `{}` if the user has no permissions at
all

![CleanShot 2024-11-20 at 18 48
46@2x](https://github.com/user-attachments/assets/90270a0b-10e5-4f22-a91e-174f82a559b2)
2024-11-21 02:10:40 +00:00
Germán Jabloñski
1f92b5b412 chore(richtext-lexical): add noImplicitAny to the richtext-lexical package (#8763) 2024-11-21 01:46:28 +00:00
Elliot DeNolf
025d917fa0 chore(release): v3.0.2 [skip ci] v3.0.2 2024-11-20 16:06:04 -05:00
Alessio Gravili
c67291d538 fix(ui): invalid permissions passed to group and named tab sub-fields (#9366)
Fixes https://github.com/payloadcms/payload/issues/9363

This fixes the following issues that caused fields to be either hidden,
or incorrectly set to readOnly in certain configurations:
- In some cases, permissions were sanitized incorrectly. This PR
rewrites the sanitizePermissions function and adds new unit tests
- after a document save, the client was receiving unsanitized
permissions. Moving the sanitization logic to the endpoint fixes this
- Various incorrect handling of permissions in our form state endpoints
/ RenderFields
2024-11-20 13:03:35 -07:00
Alessio Gravili
5db7e1e864 fix(richtext-lexical): use copy of @lexical/markdown that does not install @lexical/code (#9382)
Fixes https://github.com/payloadcms/payload/issues/9378

We’ve found out that @lexical/markdown imports cannot be reliably
dynamically imported by Node.js for an unknown reason. Frequently,
Node.js simply exits before the dynamic import is done.

We’re suspecting the reason for this to be its dependency on
@lexical/code that installs prism.

This will not only (hopefully) fix the import issue, but also reduce the
bundle size & compilation speed of richtext-lexical.
2024-11-20 13:02:57 -07:00
Jacob Fletcher
07a9125f9c fix(next): properly sets doc id types when using postgres (#9381)
Fixes #9351. When using Postgres, doc ids were being treated as a string
as opposed to a number within the admin panel. This led to issues for
anything relying on the `docID` from context, such as the join field not
properly populating initial data when creating new documents, etc.
2024-11-20 15:02:08 -05:00
Jacob Fletcher
ef3748319e fix(ui): bulk update and delete ignoring search query (#9377)
Fixes #9374.
2024-11-20 13:22:43 -05:00
Jarrod Flesch
439dcd493e fix: prioritize server rendered Actions in ActionsProvider (#9379)
### What?
Actions were not being re-rendered when router.refresh was called.
[Discord
Link](https://discord.com/channels/967097582721572934/1308636510203154462/1308648116031066173)

### Why?
They were stored in state and the state was persisting.

### How?
Spread the stateful actions and the Actions from props on top of the
client state actions.
2024-11-20 13:18:28 -05:00
Elliot DeNolf
ff0386f276 docs: improve migration guide for running db migrations 2024-11-20 11:34:57 -05:00
Said Akhrarov
568e1a274b docs: fix custom component links in admin (#9368)
### What?
Fixes links for custom components in a few places in admin docs.

### Why?
To link users to the correct location in the docs.

### How?
Changes to `docs/admin/components.mdx` and
`docs/admin/customizing-css.mdx`
2024-11-20 09:05:56 -05:00
Jacob Fletcher
9e85be0006 fix(next): autosave document rendering (#9364)
Closes #9242 and #9365. Autosave-enabled documents rendered within a
drawer were not being properly handled. This was causing multiple draft
documents to be created upon opening the drawer, as well as an empty
document returned from the server function, etc.
2024-11-19 19:01:54 -05:00
Jarrod Flesch
4030e212f5 fix: allow self referencing relationships when adding new collections to config (#9360)
### What?
Unable to add collections to the config dynamically if they reference
their own collection in a relationship field.

This was discovered while working on the folder view feature which
dynamically adds collections to your config if it is enabled per
collection.

### Why?
When `sanitizeCollection` runs, it takes the current config. If you are
sanitizing a collection before adding it to the config, that collection
cannot have any self referencing relationship fields on it otherwise it
fails the validRelationships check.

### How?
Using a reducer we now initialize the validRelationships variable with
the incoming collection slug.
2024-11-19 16:22:23 -05:00
Evan Cusack
646a5345a8 docs: update what-is-payload.mdx (#9353)
### What? 
instead of saying "it", wanted to give more context to what goes into
your Next app folder.

### Why? 
clarification

### How? 
edited docs
2024-11-19 14:53:48 -05:00