Dealing with this issue locally running
yarn dev
on Payload v1.8.2.
Expected: Based on the Payload Demo when on a "page" I click "Upload new media" on an upload field it should open an upload modal and let me add one, then I can close the modal with the media relationship set. No page transition.
What happens: When I open the media modal it refreshes the page and changes the route to the media collection. Clicking "back" in the browser it takes me to my "page" collections listings.
import { CollectionConfig } from 'payload/types';
const Media: CollectionConfig = {
slug: 'media',
versions: {
drafts: {
autosave: true,
}
},
admin: {
useAsTitle: 'filename',
group: 'Content',
},
upload: {
staticURL: '/media',
staticDir: 'assets',
imageSizes: [
{
name: 'thumbnail',
width: 400,
height: 300,
position: 'center',
},
],
adminThumbnail: 'thumbnail',
mimeTypes: ['image/*'],
},
fields: [
{
name: 'alt',
type: 'text',
},
],
};
export default Media;
Hello @.redjoker - that is odd, what version of Payload are you on?
Payload v1.8.2
Hmm, okay, do you get any errors in dev tools?
No error when I click "upload new media" from the "page" collection.
I figured it out! Turns out you shouldn't set your media to have the versioning config. The autosave was causing issues.
(You can still use drafts)
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.