Skip to content

Commit

Permalink
Merge pull request DSpace#2853 from 4Science/main-optimize-metadata-r…
Browse files Browse the repository at this point in the history
…epresenation-rendering

Avoid metadata representation element is rendered twice when checking the browse configuration
  • Loading branch information
tdonohue authored Jun 5, 2024
2 parents 2cfe7c0 + 07a03bf commit 3fbc3dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { map } from 'rxjs/operators';
import { BrowseDefinitionDataService } from '../../../../core/browse/browse-definition-data.service';
import { BrowseDefinition } from '../../../../core/shared/browse-definition.model';
import { Item } from '../../../../core/shared/item.model';
import { getRemoteDataPayload } from '../../../../core/shared/operators';
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
import { MetadataValuesComponent } from '../../../field-components/metadata-values/metadata-values.component';
import { ImageField } from './image-field';

Expand Down Expand Up @@ -75,8 +75,8 @@ export class ItemPageFieldComponent {
*/
get browseDefinition(): Observable<BrowseDefinition> {
return this.browseDefinitionDataService.findByFields(this.fields).pipe(
getRemoteDataPayload(),
map((def) => def),
getFirstCompletedRemoteData(),
map((def) => def.payload),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Item } from '../../../core/shared/item.model';
import { MetadataValue } from '../../../core/shared/metadata.models';
import { MetadataRepresentation } from '../../../core/shared/metadata-representation/metadata-representation.model';
import { MetadatumRepresentation } from '../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
import { getRemoteDataPayload } from '../../../core/shared/operators';
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component';
import { MetadataFieldWrapperComponent } from '../../../shared/metadata-field-wrapper/metadata-field-wrapper.component';
import { MetadataRepresentationLoaderComponent } from '../../../shared/metadata-representation/metadata-representation-loader.component';
Expand Down Expand Up @@ -112,8 +112,8 @@ export class MetadataRepresentationListComponent extends AbstractIncrementalList
searchKeyArray = searchKeyArray.concat(BrowseService.toSearchKeyArray(field));
});
return this.browseDefinitionDataService.findByFields(this.metadataFields).pipe(
getRemoteDataPayload(),
map((def) => Object.assign(new MetadatumRepresentation(this.itemType, def), metadatum)),
getFirstCompletedRemoteData(),
map((def) => Object.assign(new MetadatumRepresentation(this.itemType, def.payload), metadatum)),
);
}
}),
Expand Down

0 comments on commit 3fbc3dc

Please sign in to comment.