Skip to content

Commit e00c93c

Browse files
committed
Fix field collision in record generation and add test for nested entries
1 parent 3b5b16d commit e00c93c

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
* Fix regression issues that appeared after refactoring. Refs [UILD-816], [UILD-827].
1111
* Add Authority edit page. Refs [UILD-826].
1212
* Extend Search page with Authority search and create options. Refs [UILD-825].
13+
* Fix field collision in the record generation. Fixes [UILD-838].
1314

1415
[UILD-744]:https://folio-org.atlassian.net/browse/UILD-744
1516
[UILD-816]:https://folio-org.atlassian.net/browse/UILD-816
1617
[UILD-821]:https://folio-org.atlassian.net/browse/UILD-821
1718
[UILD-827]:https://folio-org.atlassian.net/browse/UILD-827
1819
[UILD-826]:https://folio-org.atlassian.net/browse/UILD-826
1920
[UILD-825]:https://folio-org.atlassian.net/browse/UILD-825
21+
[UILD-838]:https://folio-org.atlassian.net/browse/UILD-838
2022

2123
## 2.0.4 (2026-06-03)
2224
* Fix default profile type persistence across edit form and profile settings. Fixes [UILD-820].

src/common/services/recordGenerator/profileSchemaManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class ProfileSchemaManager implements IProfileSchemaManager {
3030

3131
if (parentPath && parentPath.length > 0) {
3232
return entries.filter(entry => {
33-
if (entry.path.length < parentPath.length) return false;
33+
if (entry.path.length !== parentPath.length + 1) return false;
3434

3535
for (let i = 0; i < parentPath.length; i++) {
3636
if (entry.path[i] !== parentPath[i]) return false;

src/test/__tests__/common/services/recordGenerator/profileSchemaManager.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ describe('ProfileSchemaManager', () => {
8787

8888
expect(result).toEqual([]);
8989
});
90+
91+
it('does not return deeply nested entries that share a URI with a direct child', () => {
92+
const deepEntry = {
93+
uuid: 'uuid_deep',
94+
uriBFLite: 'uri_1',
95+
path: ['parent_1', 'child_1', 'grandchild_1'],
96+
} as SchemaEntry;
97+
const schemaWithDeepEntry = new Map([...mockSchema, ['uuid_deep', deepEntry]]);
98+
99+
manager.init(schemaWithDeepEntry);
100+
101+
const result = manager.findSchemaEntriesByUriBFLite('uri_1', ['parent_1']);
102+
103+
expect(result).toEqual([mockEntry_1]);
104+
expect(result).not.toContain(deepEntry);
105+
});
90106
});
91107

92108
describe('getSchemaEntry', () => {

0 commit comments

Comments
 (0)