Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCRVS-8278 null extensions cause reindex-search to fail #8279

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/commons/src/fhir/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,6 @@ export function findExtension<URL extends AllExtensions['url']>(
): Extract<AllExtensions, { url: URL }> | undefined {
return listOfExtensions.find(
(extension): extension is Extract<AllExtensions, { url: URL }> =>
extension.url === url
extension && extension.url === url
Copy link
Member

@rikukissa rikukissa Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific valid case when the extension can be null? As per the type signature of this function, there really should be a case like that. If there is such a case, let's rather ensure null never gets into a list of extensions. Otherwise this will come back to haunt us when we migrate to Events v2 or do any other work with the potentially corrupted data.

)
}
2 changes: 1 addition & 1 deletion packages/search/src/features/fhir/fhir-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function findTaskExtension<
Task extends TaskHistory | SavedTask
>(task: Task, extensionUrl: T) {
return task.extension.find(
(ext): ext is KnownExtensionType[T] => ext.url === extensionUrl
(ext): ext is KnownExtensionType[T] => ext && ext.url === extensionUrl
)
}

Expand Down
Loading