Hey,
I might have found a bug or a missing action in Forest Admin
The issue is quite easy to reproduce, create these two models:
item.ts
import { Schema, Document, model} from 'mongoose';
import * as notes, {INotes} from './notes.ts';
interface IItem extends Document {
name: string,
notes: [INote],
// ...
}
const schema = new Schema({
'name': String
'notes': [notes]
// ...
}, {
timestamps: false,
});
export default model<IItem>('items', schema, 'Items');
So, note is basically a simple model which isn’t a collection itself and used only as nested document schema.
note.ts
import { Schema, Document, model, Types} from 'mongoose';
export interface INote extends Document {
title: string,
message: string,
// ...
}
const schema = new Schema({
"title": String,
"message": String,
// ...
}, {
timestamps: false,
});
export default model<INote>('notes', schema);
Now that you have your collection items ready, let’s create an Item by clicking on the top/right on [Add] action:
Once you clicked on it, the screen gets updated and you can edit each field of your new document. The part that we want to focus on will be on the left, within the Related data section.
Now I let you create some new Notes from the related data section.
Let’s say you created more than ONE note, I let you try to remove one
As you can see… you can’t remove any you will first need to create the item (or validate the creation of your Item) then edit it to be able to remove one or more notes from the ones you just created
Hope it helps I am quiete sure it’s a very small bug because the “Delete” action (mono or bulk) is present from the update (and it’s almost the same screen/UI)
Best,
Max