Fix <ds-search> rendering an empty page when the search configuration request fails - #6111
Open
naomigassler wants to merge 1 commit into
Open
Conversation
…figuration request fails SearchComponent derives searchSortOptions$ from SearchConfigurationService.getConfigurationSearchConfig(), which pipes through getAllSucceededRemoteDataPayload(). When that request fails the observable never emits, so the combineLatest in ngOnInit never fires and initialized$ stays false. Both @if branches in search.component.html are gated on initialized$, so the whole template is skipped and the page renders empty: not even ds-search-results, which already knows how to render an error, is created. Treat a failed configuration as "no sort options" so the component still initializes. PaginationService.getCurrentSort() already falls back to its default when handed an empty default sort, so the empty list is safe, and the outcome of the results request (results, empty state, or error) is what the user sees. This affects every ds-search instance whose configuration is not already cached. /search normally survives because the homepage caches the 'default' configuration, but /mydspace, /access-control/bulk-access and the item and collection mappers request their own configurations only on those pages, so a failure there leaves a blank page. Adds specs asserting the component still initializes, and still requests results, when the search configuration request fails.
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.
When the search-configuration request fails,
<ds-search>renders nothing atall — no results, no empty state, and no error. The page looks like an empty
repository.
getConfigurationSearchConfig()pipes throughgetAllSucceededRemoteDataPayload(),so a failed request never emits.
combineLatesttherefore never fires,initialized$staysfalse, and the whole<ds-search>template is skipped —including the
ds-errorblock thatsearch-results.componentalready has. Theerror handling is present; it is simply never constructed.
Measured on
main(3d59ea31e) with only the search-configuration requestfailing (500 on
/server/api/discover/search?configuration=*), everything elsehealthy:
With the results request failing as well — the case that should surface an error:
(38 characters is the submission drop-zone, which sits outside
<ds-search>.)Note that stopping the whole backend does not reproduce this on
main:ServerCheckGuardredirects to/500before<ds-search>renders. Theconfiguration request has to fail while the root endpoint is still reachable.
This is not specific to one page.
<ds-search>backs 6 routes, and whetheryou see the bug depends only on whether that configuration is already cached:
/searchusually survives, because the homepage has already cached the defaultconfiguration.
/mydspaceand/access-control/bulk-accesswere both in a cold-cache stateand both blanked out.
So the trigger is any search config request that fails from a cold cache — an
outage is simply the easiest way to produce one.
Fix
21 lines in one file. No new i18n key; reuses the existing
ds-errorcomponentand the existing message.
/mydspacenow shows "Error fetching search results"instead of a blank page.
Verification
Run against
check | result -- | -- /mydspace, search config failing | error rendered; main text 38 → 312 chars healthy loads × 10 | 0/10 spurious error states (609 samples at 150 ms) unit tests | 40/40 pass, + 2 new covering error-vs-empty npm run lint | clean — "All files pass linting" npm run check-circ-deps | "No circular dependency found!" npm run build:prod | succeedsmainat3d59ea31e:Screenshots: blank page before, error state after, and the ordinary
"Your search returned no results" empty state for comparison — the error and empty
states are unmistakably distinct.
<screenshots: V1-mydspace-down.png, V5-mydspace-down.png, V5-mydspace-empty-state.png>Known limitation
Some installations report a
400on this endpoint when the search fires beforeauthentication is attached (
An anonymous user cannot perform a workspace or workflow search). Upstream already treats that as "no results" viashowError()'sstatusCode !== 400exemption, and this change leaves that exemption intact. Ourstack does not reproduce that 400, so we have shown that this change does not
introduce a spurious error state — not that it handles that case correctly.
Confirmation from someone who can reproduce it would be welcome.
Before: upstream

mainwith the search-configuration request returning 500(results request also failing).
/mydspacerenders an empty content area — noresults, no empty state, no error.
ds-search-form,ds-search-resultsandds-errorare all absent from the DOM; the only content is the submissiondrop-zone, which sits outside
<ds-search>.After: same code path with this fix applied, same injected 500s. The component
initialises, so
ds-search-resultsis created and renders its existing errorstate — "Error fetching search results".
Two details in this image are worth naming rather than leaving to be spotted.

The filter label
search.filters.filter.owningcollection.headis untranslated:that key is absent from upstream
en.json5(grep -c→ 0) and appears onhealthy
/mydspaceloads on unmodifiedmaintoo — it is visible here onlybecause the fix makes the sidebar render at all. The Sort By control is
empty because its options come from the search configuration, which is the
request that failed. Neither is introduced by this change, and neither is
claimed to be fixed by it: the claim is an error message instead of an empty
page, not a fully functional page in a state where the configuration is
unavailable.
For comparison: this fix applied, healthy backend, a configuration with no

results ("Workflow tasks"). The ordinary empty state — "Your search returned no
results" — is still clearly distinct from the error state above.