mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 08:47:20 +00:00
fix(ui-schema-storage): duplicate of empty schema
This commit is contained in:
parent
29b47c1d40
commit
5de28cd4c4
@ -225,6 +225,11 @@ describe('ui_schema repository', () => {
|
||||
expect(s2['x-uid']).not.toEqual(s['x-uid']);
|
||||
});
|
||||
|
||||
it('should be null', async () => {
|
||||
const s2 = await repository.duplicate('test-null');
|
||||
expect(s2).toBeNull();
|
||||
});
|
||||
|
||||
describe('schema', () => {
|
||||
let schema;
|
||||
beforeEach(() => {
|
||||
|
@ -445,6 +445,9 @@ export class UiSchemaRepository extends Repository {
|
||||
@transaction()
|
||||
async duplicate(uid: string, options?: Transactionable) {
|
||||
const s = await this.getJsonSchema(uid, { ...options, includeAsyncNode: true });
|
||||
if (!s?.['x-uid']) {
|
||||
return null;
|
||||
}
|
||||
this.regenerateUid(s);
|
||||
return this.insert(s, options);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user