Persist collapsed state in GLQL blocks

What does this MR do and why?

Persist collapsed state in GLQL blocks

In !197824 (merged) we added support for a collapsed parameter to GLQL views, which if passed true would keep the view collapsed by default. However, due to a bug in crud component, this would always be disregarded because crud component would emit an expanded event on mount that would override the value read from config.

This MR fixes that bug. Now we dispatch expanded or collapsed events only if a value is present in local storage, whether true or false, but not if its not set.

Changelog: added

References

Follow up from Add a collapsed parameter to GLQL (!197824 - merged)

Screenshots or screen recordings

CleanShot 2025-07-17 at 16.32.35.mp4

How to set up and validate locally

  1. Setup a GLQL component with collapsed: true in it. Example:

    ```glql
    query: type = Issue
    collapsed: true
    ```
  2. Save the comment/issue and reload.

  3. The view should be collapsed by default. (Reading the value from the GLQL config)

  4. Expand the view by clicking the chevron on crud component.

  5. Refresh the page.

  6. The component should stay expanded. (Reading the value from local storage)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Himanshu Kapoor

Merge request reports

Loading