Skip to content

Commit

Permalink
fix(SubmodelSearcher)-fix-submodel-load-from-registry
Browse files Browse the repository at this point in the history
  • Loading branch information
pawel-baran-se committed Dec 4, 2024
1 parent 6fa448d commit afd1d31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/app/[locale]/viewer/[base64AasId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function Page() {
const [aasFromContext, setAasFromContext] = useAasState();
const [submodels, setSubmodels] = useSubmodelState();
const [isSubmodelsLoading, setIsSubmodelsLoading] = useState(true);
const [registryAasData] = useRegistryAasState();
const [registryAasData, setRegistryAasData] = useRegistryAasState();

useAsyncEffect(async () => {
await fetchSubmodels();
Expand Down Expand Up @@ -84,6 +84,7 @@ export default function Page() {
showError(new LocalizedError(messages.mnestix.aasUrlNotFound), notificationSpawner);
} else if (result.aas) {
setAasOriginUrl(result.aasData?.aasRepositoryOrigin ?? null);
setRegistryAasData(result.aasData);
setAasFromContext(result.aas);
} else {
navigate.push(result.redirectUrl);
Expand Down
5 changes: 2 additions & 3 deletions src/lib/services/searchUtilActions/SubmodelSearcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ export class SubmodelSearcher {

const descriptorById = await this.getSubmodelDescriptorById(submodelId);
const descriptor =
submodelDescriptor || (process.env.SUBMODEL_REGISTRY_API_URL && descriptorById.isSuccess)
? descriptorById.result
: null;
submodelDescriptor ||
(process.env.SUBMODEL_REGISTRY_API_URL && descriptorById.isSuccess ? descriptorById.result : null);
const endpoint = descriptor?.endpoints[0].protocolInformation.href;

if (endpoint) {
Expand Down

0 comments on commit afd1d31

Please sign in to comment.