Problem/Motivation
I've installed the project browser devel. When i go to admin/config/development/project_browser I get the following warning:
Warning: Trying to access array offset on int in Drupal\project_browser\Form\SettingsForm->buildForm() (line 162 of /var/www/html/repos/project_browser/src/Form/SettingsForm.php).
Drupal\project_browser\Form\SettingsForm->buildForm()
call_user_func_array() (Line: 528)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)in addition the source type added by the sub module has no label:

and in addition to that admin/modules/browse only shows the three source types drupal.org, recipes and drupal core, the source type added by the project browser devel module has no tab.
Steps to reproduce
Proposed resolution
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Screenshot from 2024-11-19 12-02-46.png | 42.78 KB | shalini_jha |
| sourcetypes.jpg | 62.1 KB | rkoller |
Issue fork project_browser-3479924
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
Comment #2
chrisfromredfinComment #3
chrisfromredfinconfirming this is still reproducible
Comment #7
shalini_jha commentedComment #9
shalini_jha commentedI was able to replicate the issue and after debugging, I found that the data was not updating on module installation due to caching. To resolve this, I invalidated the configuration cache tag in the hook_install(), and it is working as expected now. Moving forward for NR. Let me know if anything else needs to be updated regarding this.
Kindly review.
Comment #10
narendrarThanks @shalini for working on this issue. However this issue still exists after applying your changes.
Steps to reproduce with your MR applied:
Using below code in .install can fix it.
\Drupal::service('cache.discovery')->deleteAll();Comment #11
shalini_jha commentedThanks for your review . i am working on it.
Comment #12
utkarsh_33 commented@shalini_jha are you still working on this?
Comment #13
shalini_jha commentedThank you for the review, @narendrar.
While the single tag invalidation seemed to work during my initial testing, I have implemented your suggested change to invalidate the cache.
I have verified the steps again, and this is working as expected.
Please review the updated code and let me know if further changes are required.
Comment #14
narendrarThis looks good, adding test coverage could be beneficial here.
Comment #15
shalini_jha commentedsure, I am checking for test
Comment #16
shalini_jha commentedComment #17
shalini_jha commentedThe test coverage is not failing in either scenario. After installing the Project Browser Devel module in test coverage , the problem is no longer replicating.it might clear cache in all scenario, I have also attempted to add a functional test in testInstallation(), but it is not showing any failing tests in the same way.
Please Let me know if something is missing for this test, Moving this for NR , to get some help to achieve this test coverage.
Comment #18
shalini_jha commentedComment #19
narendrarIt seems that the cache is already being cleared during tests, which is why this issue is not reproducible. You can proceed with the fix as suggested at https://git.drupalcode.org/project/project_browser/-/merge_requests/621#... and remove the test for now.
If necessary, a follow-up can be created to investigate the test further.
Comment #20
shalini_jha commented@narendrar Thank you for your suggestion. I have removed the test case as per your feedback and made the necessary adjustments. I have validated that the functionality is working correctly after these changes. I am moving this to 'Needs Review'. Also, I noticed that eslint is failing, but I believe that issue is not related to the changes made here.
Comment #21
narendrarLooks good to me.
Comment #23
chrisfromredfinThanks for the reviews, Naren!