Skip to content

Several dashboard fixes#508

Merged
rteyssandier merged 5 commits intoopenflocon:mainfrom
snappdevelopment:fix-dashboard-arrangement-key
Mar 9, 2026
Merged

Several dashboard fixes#508
rteyssandier merged 5 commits intoopenflocon:mainfrom
snappdevelopment:fix-dashboard-arrangement-key

Conversation

@snappdevelopment
Copy link
Copy Markdown
Contributor

@snappdevelopment snappdevelopment commented Mar 7, 2026

Hi,
I am currently seeing a few behaviour issues on the dashboard screen. This tries to fix all of them.

  1. The selected arrangement is reset every time the app is restarted
  2. The selected dashboard is reset every time the app is restarted
  3. The dashboards in the list are reordered several times when the app is restarted
  • The first issue is fixed by using a combination of package name and dashboard id as the map key for the arrangement.
  • The second issue is fixed by using the package name as the map key for the selected dashboard.

Until now the whole DeviceIdAndPackageNameDomainModel was used as the key, but it also contains the app instance id which changes with every app restart.

  • The third issue is fixed by sorting the dashboard list by the dashboard id.

The issue exists because dashboards can be registered at different points in time during app start (or even later), which returns a new list of dashboards from the room database and that list can have a different order every time.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses several critical dashboard stability and persistence issues. It refactors how selected dashboards and their arrangements are stored, moving away from volatile identifiers to more stable keys derived from package names and dashboard IDs. Additionally, it introduces consistent sorting for dashboard lists, ensuring a predictable user experience across application restarts.

Highlights

  • Persistent Dashboard Arrangement: The selected dashboard arrangement now persists across app restarts by using a combination of package name and dashboard ID as the storage key, preventing resets due to changing app instance IDs.
  • Persistent Selected Dashboard: The currently selected dashboard now remains selected after app restarts by utilizing only the package name as the storage key, addressing issues caused by volatile app instance IDs.
  • Stable Dashboard Ordering: Dashboards are now consistently ordered by their ID in the UI, resolving an issue where their display order would unpredictably change upon app restarts due to varying registration times.
Changelog
  • FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/features/dashboard/delegate/DashboardSelectorDelegate.kt
    • Introduced sorting for the list of dashboards by their ID to ensure consistent ordering.
    • Ensured the first dashboard in the sorted list is selected if no dashboard was previously selected.
  • FloconDesktop/data/core/src/commonMain/kotlin/io/github/openflocon/data/core/dashboard/datasource/DeviceDashboardsDataSource.kt
    • Updated observeDashboardArrangement and selectDashboardArrangement methods to accept dashboardId as a parameter.
    • Reordered parameters for selectDeviceDashboard to place dashboardId first.
  • FloconDesktop/data/core/src/commonMain/kotlin/io/github/openflocon/data/core/dashboard/repository/DashboardRepositoryImpl.kt
    • Adjusted selectDeviceDashboard method signature and internal call to match the new parameter order.
    • Modified observeDashboardArrangement and selectDashboardArrangement to pass dashboardId to the data source.
  • FloconDesktop/data/local/src/commonMain/kotlin/io/github/openflocon/data/local/dashboard/datasource/DeviceDashboardsDataSourceInMemory.kt
    • Changed the keys for selectedDeviceDashboards and selectedDashboardArrangements maps from DeviceIdAndPackageNameDomainModel to String to ensure persistence across app restarts.
    • Implemented getSelectedDashboardKey to use only the package name for selected dashboard persistence.
    • Implemented getDashboardArrangementKey to use a combination of package name and dashboard ID for arrangement persistence.
    • Updated all internal calls to use the new key generation logic.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/dashboard/repository/DashboardRepository.kt
    • Updated the DashboardRepository interface to reflect the new dashboardId parameter in observeDashboardArrangement and selectDashboardArrangement methods.
    • Reordered parameters for selectDeviceDashboard in the interface.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/dashboard/usecase/ObserveDashboardArrangementUseCase.kt
    • Modified the use case to first observe the currently selected dashboard and then use its ID to observe the dashboard arrangement, ensuring the correct arrangement is loaded.
  • FloconDesktop/domain/src/commonMain/kotlin/io/github/openflocon/domain/dashboard/usecase/SelectDashboardArrangementUseCase.kt
    • Injected GetCurrentDeviceSelectedDashboardUseCase to retrieve the currently selected dashboard ID.
    • Used the retrieved dashboard ID when calling dashboardRepository.selectDashboardArrangement.
Activity
  • No specific activity (comments, reviews) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses several state persistence and UI stability issues on the dashboard screen by using more stable keys for storing the selected dashboard and its arrangement, and sorting the dashboard list for consistent order. However, the fix for stable keys in the in-memory data source introduces a medium-severity Broken Access Control vulnerability. Omitting the deviceId from storage keys causes data to be shared across different devices, leading to cross-device data collisions. Additionally, there's a suggestion to improve the robustness of key generation for dashboard arrangements.

@rteyssandier rteyssandier added the bug Something isn't working label Mar 7, 2026
@rteyssandier rteyssandier merged commit b3cd442 into openflocon:main Mar 9, 2026
2 checks passed
@snappdevelopment
Copy link
Copy Markdown
Contributor Author

Hi @rteyssandier, can we get a new release for these fixes please? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants