fix(#0090): replace remote datasource with PouchDB views for Select2 contact search#91
Merged
hectorguillen-blip merged 2 commits intoJun 3, 2026
Conversation
jomcarvajal
approved these changes
Jun 2, 2026
40e37fb
into
feature/user-display-authorization
184 of 200 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the facility and associated contact Select2 dropdowns in the UserFormComponent, which were returning no results due to an incorrect data source.
Closes #13
Root cause
The original implementation used
CHTDatasourceServicewithgetRemoteDataContext()which requirescontact_typesto be configured in CHT settings to know which types to query. Most instances do not have this configured, causing the dropdowns to return empty results silently.Changes
Select2SearchService
CHTDatasourceServicewithDbService— queries PouchDB directlymedic-offline-freetext/contacts_by_type_freetextview for term-based search, matching the original AngularJSSelect2Searchservice behaviourformat.sender()outputisContactInPlacenow usesdb.get().get()instead of the remote APIFreetextDesignDocService
_design/medic-offline-freetexton app startup and creates it if missingAPP_INITIALIZERinapp.config.tsso the view is available on every environment without manual setupapp.config.ts
FreetextDesignDocServiceinitializerTests
select2search.service.spec.tsto useDbServicemock instead ofCHTDatasourceServiceChecklist