Skip to content

Fix result clearing for non-query calls and home page + history results page toggling #3553

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 8 commits into from
May 19, 2025

Conversation

jjw24
Copy link
Member

@jjw24 jjw24 commented May 17, 2025

Changes:

  • Fix result clearing for non-query calls
  • Fix home page toggle shows/clear results
  • History results page toggling shows/clear results

Tested:

  • Home page toggle off clears results & on shows results
  • History results page toggle off clear results and on shows results
  • Global query -> home page no flicker
  • Action keyword -> home page no flicker
  • Global query -> history results page no flicker
  • Action keyword -> history results page no flicker
  • Global query -> action keyword no flicker
  • Action keyword -> global query no flicker

Follow on from #3524

@jjw24 jjw24 added this to the 1.20.0 milestone May 17, 2025
@jjw24 jjw24 requested review from Jack251970 and Copilot May 17, 2025 12:02
@jjw24 jjw24 self-assigned this May 17, 2025
@jjw24 jjw24 added the Dev branch only An issue or fix for the Dev branch build label May 17, 2025
@prlabeler prlabeler bot added the bug Something isn't working label May 17, 2025
@jjw24 jjw24 removed the bug Something isn't working label May 17, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issues with result clearing for non-query calls and improves toggling behavior on the home and history results pages.

  • Updates logging and result clearing logic in ResultsViewModel and MainViewModel.
  • Refactors the methods determining when to clear results based on query type.
  • Updates event handling in MainWindow.xaml.cs and refines the ShowHistoryResultsForHomePage property implementation in Settings.cs.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
Flow.Launcher/ViewModel/ResultsViewModel.cs Adds a block to clear existing results based on a flag in non-query calls.
Flow.Launcher/ViewModel/MainViewModel.cs Renames and refines methods for determining when to clear results, with updated logging.
Flow.Launcher/MainWindow.xaml.cs Changes the OnLoaded event handler from async to synchronous and adds a case for the history results toggle.
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Refactors the ShowHistoryResultsForHomePage property to use a backing field with property change notification.
Comments suppressed due to low confidence (1)

Flow.Launcher.Infrastructure/UserSettings/Settings.cs:176

  • Consider making the backing field '_showHistoryResultsForHomePage' private (e.g., private bool _showHistoryResultsForHomePage) to follow standard naming conventions and avoid exposing internal state.
public bool _showHistoryResultsForHomePage { get; set; } = false;

@jjw24 jjw24 enabled auto-merge May 17, 2025 12:03

This comment has been minimized.

Copy link

gitstream-cm bot commented May 17, 2025

🥷 Code experts: Jack251970, onesounds

Jack251970, onesounds have most 👩‍💻 activity in the files.
Jack251970, onesounds have most 🧠 knowledge in the files.

See details

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 28 additions & 6 deletions
APR 34 additions & 83 deletions 104 additions & 38 deletions
MAR 142 additions & 94 deletions 10 additions & 0 deletions
FEB 10 additions & 4 deletions
JAN 17 additions & 4 deletions
DEC 1 additions & 1 deletions

Knowledge based on git-blame:
Jack251970: 24%
onesounds: 21%

Flow.Launcher/MainWindow.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 130 additions & 33 deletions 5 additions & 1 deletions
APR 69 additions & 45 deletions 5 additions & 1 deletions
MAR 1141 additions & 1076 deletions 327 additions & 141 deletions
FEB 1 additions & 1 deletions 8 additions & 4 deletions
JAN
DEC 5 additions & 10 deletions

Knowledge based on git-blame:
Jack251970: 68%
onesounds: 14%

Flow.Launcher/ViewModel/MainViewModel.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 513 additions & 315 deletions
APR 35 additions & 28 deletions
MAR 695 additions & 628 deletions 293 additions & 201 deletions
FEB 63 additions & 21 deletions 23 additions & 25 deletions
JAN 17 additions & 21 deletions
DEC 59 additions & 63 deletions

Knowledge based on git-blame:
Jack251970: 40%
onesounds: 9%

Flow.Launcher/ViewModel/ResultsViewModel.cs

Activity based on git-commit:

Jack251970 onesounds
MAY 17 additions & 7 deletions
APR 4 additions & 5 deletions
MAR 8 additions & 6 deletions
FEB
JAN
DEC

Knowledge based on git-blame:
Jack251970: 7%
onesounds: 5%

To learn more about /:\ gitStream - Visit our Docs

Copy link

gitstream-cm bot commented May 17, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

1 similar comment
Copy link

gitstream-cm bot commented May 17, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Contributor

coderabbitai bot commented May 17, 2025

📝 Walkthrough

Walkthrough

This change refactors how the ShowHistoryResultsForHomePage setting is handled, adding property change notification and integrating it into the UI's response logic. It also refines the logic for clearing query results in the main view model, introducing clearer separation between query and non-query scenarios, and adds additional debug logging for result clearing.

Changes

File(s) Change Summary
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Converted ShowHistoryResultsForHomePage from an auto-property to a full property with a backing field and property change notification.
Flow.Launcher/MainWindow.xaml.cs Changed OnLoaded from async to sync; added handling for ShowHistoryResultsForHomePage property changes to update results when toggled.
Flow.Launcher/ViewModel/MainViewModel.cs Refactored result-clearing logic: renamed and split ShouldClearExistingResults into query and non-query variants; added related debug logs.
Flow.Launcher/ViewModel/ResultsViewModel.cs Added debug logging when existing results are cleared based on update conditions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Settings
    participant MainWindow
    participant MainViewModel
    participant ResultsViewModel

    User->>Settings: Toggle ShowHistoryResultsForHomePage
    Settings-->>MainWindow: PropertyChanged event (ShowHistoryResultsForHomePage)
    MainWindow->>MainViewModel: QueryResults() (if query is empty and results selected)
    MainViewModel->>ResultsViewModel: Update results (may clear based on new logic)
    ResultsViewModel->>ResultsViewModel: Log if results are cleared
Loading

Possibly related PRs

  • Flow-Launcher/Flow.Launcher#3524: Extends clearing logic in MainViewModel and integrates property change notification for ShowHistoryResultsForHomePage.
  • Flow-Launcher/Flow.Launcher#3399: Introduces the initial ShowHistoryResultsForHomePage property and home page querying support, related to this PR’s refinement of that property and event handling.

Suggested labels

bug, kind/ux

Suggested reviewers

  • jjw24
  • taooceros

Poem

A toggle flips, a rabbit grins,
History on home now notifies kin.
With logic split for query and not,
Results are cleared—or sometimes not!
Debug logs hop through the code,
Ensuring clarity on this new road.
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7399d11 and 2770c6a.

📒 Files selected for processing (4)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (2 hunks)
  • Flow.Launcher/MainWindow.xaml.cs (2 hunks)
  • Flow.Launcher/ViewModel/MainViewModel.cs (9 hunks)
  • Flow.Launcher/ViewModel/ResultsViewModel.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • Flow.Launcher/ViewModel/ResultsViewModel.cs
  • Flow.Launcher/MainWindow.xaml.cs
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs
  • Flow.Launcher/ViewModel/MainViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb25c53 and 073594f.

📒 Files selected for processing (4)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1 hunks)
  • Flow.Launcher/MainWindow.xaml.cs (2 hunks)
  • Flow.Launcher/ViewModel/MainViewModel.cs (9 hunks)
  • Flow.Launcher/ViewModel/ResultsViewModel.cs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
Flow.Launcher/ViewModel/MainViewModel.cs (4)
Flow.Launcher.Plugin/Query.cs (1)
  • Query (8-102)
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs (1)
  • LogDebug (255-255)
Flow.Launcher.Core/Plugin/PluginManager.cs (3)
  • ICollection (267-279)
  • ICollection (281-284)
  • PluginPair (380-383)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)
  • Settings (16-485)
🪛 GitHub Actions: Check Spelling
Flow.Launcher/MainWindow.xaml.cs

[warning] 61-61: WMP is not a recognized word. (unrecognized-spelling)


[warning] 82-82: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 83-83: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 84-84: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 111-111: Wnd is not a recognized word. (unrecognized-spelling)


[warning] 336-336: Wnd is not a recognized word. (unrecognized-spelling)


[warning] 460-460: VSTHRD is not a recognized word. (unrecognized-spelling)


[warning] 475-475: VSTHRD is not a recognized word. (unrecognized-spelling)


[warning] 487-487: VSTHRD is not a recognized word. (unrecognized-spelling)


[warning] 491-491: Wnd is not a recognized word. (unrecognized-spelling)


[warning] 493-493: Wnd is not a recognized word. (unrecognized-spelling)


[warning] 564-564: WMP is not a recognized word. (unrecognized-spelling)


[warning] 566-566: WMP is not a recognized word. (unrecognized-spelling)


[warning] 567-567: WMP is not a recognized word. (unrecognized-spelling)


[warning] 648-648: gamemode is not a recognized word. (unrecognized-spelling)


[warning] 649-649: gamemode is not a recognized word. (unrecognized-spelling)


[warning] 652-652: gamemode is not a recognized word. (unrecognized-spelling)


[warning] 655-655: positionreset is not a recognized word. (unrecognized-spelling)


[warning] 658-658: positionreset is not a recognized word. (unrecognized-spelling)


[warning] 674-674: gamemode is not a recognized word. (unrecognized-spelling)


[warning] 675-675: positionreset is not a recognized word. (unrecognized-spelling)


[warning] 680-680: positionreset is not a recognized word. (unrecognized-spelling)


[warning] 790-790: XRatio is not a recognized word. (unrecognized-spelling)


[warning] 791-791: YRatio is not a recognized word. (unrecognized-spelling)


[warning] 1005-1005: clocksb is not a recognized word. (unrecognized-spelling)


[warning] 1006-1006: clocksb is not a recognized word. (unrecognized-spelling)


[warning] 1007-1007: iconsb is not a recognized word. (unrecognized-spelling)


[warning] 1008-1008: iconsb is not a recognized word. (unrecognized-spelling)


[warning] 1013-1013: clocksb is not a recognized word. (unrecognized-spelling)


[warning] 1014-1014: iconsb is not a recognized word. (unrecognized-spelling)

Flow.Launcher/ViewModel/MainViewModel.cs

[warning] 72-72: Ioc is not a recognized word. (unrecognized-spelling)


[warning] 1727-1727: VSTHRD is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (6)
Flow.Launcher/ViewModel/ResultsViewModel.cs (1)

238-241: Enhanced debugging with clear log message.

Adding debug logging when results are cleared provides valuable diagnostic information that will help track result clearing behavior, making it easier to understand when and why results are being refreshed.

Flow.Launcher/MainWindow.xaml.cs (1)

278-278: Good addition of ShowHistoryResultsForHomePage to the settings property changed handler.

This change ensures that the UI properly reacts to changes in the history results setting the same way it does for the home page setting, maintaining consistent behavior when either setting is toggled.

Flow.Launcher/ViewModel/MainViewModel.cs (4)

1341-1345: Good conditional clearing of results for non-query scenarios.

This code properly checks if results should be cleared when no query is running by calling the new ShouldClearExistingResultsForNonQuery method. Adding debug logging also helps with diagnostics.


1565-1582: Improved method naming for clarity.

Renaming the method to ShouldClearExistingResultsForQuery more accurately describes its purpose. The addition of debug logging helps track when results are being cleared.


1584-1602: Well-implemented method for handling non-query result clearing logic.

This new method nicely encapsulates the logic for determining when to clear results in non-query scenarios. It checks both the setting state and the plugin collection state to make the correct decision.


1313-1313: Simplified debug logging for plugin list.

Good simplification of the debug logging for valid plugins by inlining the plugin name selection.

This comment has been minimized.

This comment has been minimized.

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors and Warnings Count
❌ forbidden-pattern 24
⚠️ non-alpha-in-dictionary 13

See ❌ Event descriptions for more information.

Forbidden patterns 🙅 (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

s.b. workaround(s)

\bwork[- ]arounds?\b
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@jjw24 jjw24 merged commit 3abb2f0 into dev May 19, 2025
14 checks passed
@jjw24 jjw24 deleted the fix_result_clearing_nonquery branch May 19, 2025 08:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Dev branch only An issue or fix for the Dev branch build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants