Problem/Motivation

When you enable the Recipes source to view local recipes, the Recommended add-ons source stops working -- it no longer shows any results. Disabling the Recipes source doesn't fix it either, still says "No projects found".

Steps to reproduce

  1. Install Drupal CMS
  2. Enable the Recipes source
  3. Visit Recommended add-ons and see there are no results

Proposed resolution

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pameeela created an issue. See original summary.

velmir_taky’s picture

Status: Active » Needs review
StatusFileSize
new937 bytes

Root cause

SettingsForm::submitForm() resets every enabled source's configuration to an empty array [] when saving. This wipes any per-source settings that were previously configured.

The recommended source stores its uri (the URL to a curated YAML project list) in its source configuration within enabled_sources. When a user toggles any source (e.g. enabling Recipes) and saves the form, the uri is lost. Recommended::loadProjects() then sees uri = NULL and returns zero results.

Disabling the Recipes source afterward does not restore the Recommended source because the uri was already wiped from config on the previous save.

Fix

The one-line change in SettingsForm::submitForm() preserves existing per-source configuration instead of resetting it to []:

// Before (bug):
$enabled_sources[$plugin_id] = [];

// After (fix):
$current_sources = $settings->get('enabled_sources') ?? [];
$enabled_sources[$plugin_id] = $current_sources[$plugin_id] ?? [];

Sources that were previously disabled and are now being enabled still get [] (which correctly triggers defaults via defaultConfiguration()).

Steps to test

  1. 1. Install Drupal CMS (which configures the recommended source with a uri)
  2. 2. Verify Recommended add-ons show results
  3. 3. Go to /admin/config/development/project_browser and enable the Recipes source
  4. 4. Save configuration
  5. 5. Verify Recommended add-ons still show results (previously broken)
  6. 6. Disable Recipes source and save again
  7. 7. Verify Recommended add-ons still work (previously broken)

velmir_taky’s picture

The failing test testApplyMultipleRecipes appears to be a pre-existing flaky test unrelated to this patch. The fix only modifies SettingsForm::submitForm() to preserve existing source configuration when saving.

pameeela’s picture

Title: Enabling the local recipes source breaks the Recommended source » Saving the Project Browser settings form wipes the config for enabled sources
phenaproxima’s picture

Status: Needs review » Needs work

All PHPUnit test jobs are failing. It seems unlikely that they would all break, on the same test, for the same reason, if this patch had not broken something. This probably needs further investigation/work.

velmir_taky’s picture

Status: Needs work » Needs review

Cleaned up MR !880 — it now contains only the one-line SettingsForm::submitForm() fix.

I investigated the testApplyMultipleRecipes failure extensively. Root cause: Svelte's bind:value on the search input relies on input events, but Selenium's setValue() in CI (Selenium Grid + headless Chrome) doesn't reliably trigger them. I tried dispatchEvent('input') + JS wait for title change — passes locally 3/3 but still fails in CI. This is a pre-existing flaky test that fails on the 2.1.x branch as well, unrelated to the SettingsForm fix.

17/18 InstallerUi tests pass. All other test suites pass.