Skip to content

Address PR feedback on FeatureViewModel template#134

Merged
efargas merged 2 commits intoaudit/comprehensive-review-2025from
feature/update-viewmodel-template-8714801939707767319
Mar 8, 2026
Merged

Address PR feedback on FeatureViewModel template#134
efargas merged 2 commits intoaudit/comprehensive-review-2025from
feature/update-viewmodel-template-8714801939707767319

Conversation

@efargas
Copy link
Copy Markdown
Owner

@efargas efargas commented Mar 8, 2026

I have addressed the Qodo code review suggestions by:

  1. Making the mock ViewModel types public so they work better with XAML compiled bindings and type resolution.
  2. Implementing a caching pattern for the content ViewModels within the FeatureViewModel template, ensuring that state is preserved when switching between categories and that resources are properly disposed of when the main ViewModel is destroyed.

PR created automatically by Jules for task 8714801939707767319 started by @efargas

google-labs-jules bot and others added 2 commits March 8, 2026 16:09
- Changed [FEATURE_NAME]OverviewViewModel, [FEATURE_NAME]DetailsViewModel, and [FEATURE_NAME]SettingsViewModel from internal to public in the template.
- This ensures the scaffolded classes are accessible when the template is used.

Co-authored-by: efargas <9705611+efargas@users.noreply.github.com>
- Changed mock ViewModels from internal to public to ensure XAML type resolution compatibility.
- Implemented caching for Overview, Details, and Settings ViewModels to preserve state between sidebar navigation.
- Added disposal logic for cached ViewModels to prevent resource leaks.
- Updated SelectedContentViewModel type to ViewModelBase.

Co-authored-by: efargas <9705611+efargas@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Implement ViewModel caching and make mock classes public

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Implement caching pattern for content ViewModels to preserve state
• Change mock ViewModel classes from internal to public
• Add proper disposal logic for cached ViewModels
• Update SelectedContentViewModel type from object to ViewModelBase
Diagram
flowchart LR
  A["FeatureViewModel Template"] -->|"Caches"| B["OverviewViewModel"]
  A -->|"Caches"| C["DetailsViewModel"]
  A -->|"Caches"| D["SettingsViewModel"]
  B -->|"Implements"| E["ViewModelBase"]
  C -->|"Implements"| E
  D -->|"Implements"| E
  A -->|"Disposes on cleanup"| F["Cached ViewModels"]
Loading

Grey Divider

File Changes

1. docs/templates/ui-integration/FeatureViewModel.template.cs ✨ Enhancement +45/-15

Add ViewModel caching and make mock classes public

• Added private fields to cache Overview, Details, and Settings ViewModels
• Changed SelectedContentViewModel type from object to ViewModelBase for type safety
• Implemented null-coalescing caching pattern in Create methods to preserve state
• Added disposal logic in Dispose method to clean up cached ViewModels
• Made mock ViewModel classes public and moved them to dedicated region at end of file

docs/templates/ui-integration/FeatureViewModel.template.cs


Grey Divider

Qodo Logo

@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 feedback on the FeatureViewModel template by enhancing its design for better UI integration and resource management. It makes mock ViewModel types public to support XAML compiled bindings and introduces a caching mechanism for content ViewModels. This ensures that the application's state is maintained across category switches and that resources are correctly released upon ViewModel disposal.

Highlights

  • Mock ViewModel Visibility: Made mock ViewModel types public to improve compatibility with XAML compiled bindings and type resolution.
  • Content ViewModel Caching: Implemented a caching pattern for content ViewModels within the FeatureViewModel template.
  • State Preservation & Disposal: Ensured that state is preserved when switching between categories and that resources are properly disposed of when the main ViewModel is destroyed.
Changelog
  • docs/templates/ui-integration/FeatureViewModel.template.cs
    • The _selectedContentViewModel field's type was changed from object? to ViewModelBase?, and new private fields (_overviewVm, _detailsVm, _settingsVm) were added to hold cached ViewModel instances.
    • The SelectedContentViewModel public property's type was updated from object? to ViewModelBase?.
    • The Create[FEATURE_NAME]OverviewViewModel, Create[FEATURE_NAME]DetailsViewModel, and Create[FEATURE_NAME]SettingsViewModel methods were modified to return specific ViewModel types and implement a caching pattern using null-coalescing assignment.
    • Disposal logic was added within the Dispose method to correctly dispose of cached ViewModels (_overviewVm, _detailsVm, _settingsVm) if they implement IDisposable.
    • New public mock ViewModel classes ([FEATURE_NAME]OverviewViewModel, [FEATURE_NAME]DetailsViewModel, [FEATURE_NAME]SettingsViewModel) were added to the file.
Activity
  • No specific activity (comments, reviews, progress) 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.

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review bot commented Mar 8, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Template creates duplicate VMs 🐞 Bug ✓ Correctness
Description
The template now defines public stub child ViewModel types
([Feature]Overview/Details/SettingsViewModel) in the same file, while the integration checklist
instructs creating those same types as separate files—following the checklist will cause
duplicate-type compilation errors. This is a high-likelihood blocker because the README/checklist
explicitly tells devs to copy this template into src/ where it will be compiled.
Code

docs/templates/ui-integration/FeatureViewModel.template.cs[R264-285]

+#region Mock ViewModels
+
+/// <summary>
+/// Mock Overview ViewModel for design-time and initial implementation.
+/// </summary>
+public class [FEATURE_NAME]OverviewViewModel : ViewModelBase
+{
+}
+
+/// <summary>
+/// Mock Details ViewModel for design-time and initial implementation.
+/// </summary>
+public class [FEATURE_NAME]DetailsViewModel : ViewModelBase
+{
+}
+
+/// <summary>
+/// Mock Settings ViewModel for design-time and initial implementation.
+/// </summary>
+public class [FEATURE_NAME]SettingsViewModel : ViewModelBase
+{
+}
Evidence
The template now includes concrete public type declarations for the child ViewModels and
instantiates them in UpdateMainContent(). Separately, the official integration checklist directs
developers to create those child ViewModel files (same names), and the README instructs copying the
template into src/, meaning both definitions will exist and the project will fail to compile with
duplicate type definitions.

docs/templates/ui-integration/FeatureViewModel.template.cs[264-285]
docs/templates/ui-integration/FeatureViewModel.template.cs[146-196]
docs/templates/ui-integration/INTEGRATION_CHECKLIST.md[34-49]
docs/templates/ui-integration/README.md[67-82]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The FeatureViewModel template now declares public stub child ViewModel classes (`[Feature]OverviewViewModel`, `[Feature]DetailsViewModel`, `[Feature]SettingsViewModel`) in the same file. The UI integration checklist also instructs developers to create those child ViewModels as separate files, which will produce duplicate-type compile errors when someone follows the documented workflow.

## Issue Context
This template is intended to be copied into `src/` (per README), so its contents will compile as part of the app.

## Fix Focus Areas
- docs/templates/ui-integration/FeatureViewModel.template.cs[264-285]
- docs/templates/ui-integration/INTEGRATION_CHECKLIST.md[34-49]
- docs/templates/ui-integration/README.md[67-82]

## Suggested changes
- Preferred: Change the mock/stub child ViewModel declarations to `public partial class ...` and update the checklist to explicitly instruct creating `partial` implementations in separate files (or extending these partial stubs), avoiding CS0101 duplicate-type errors.
- Alternative: Remove the stub child ViewModels from the main template and add separate templates/files for child ViewModels, updating the checklist/README to match.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

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 effectively addresses previous feedback by implementing a caching pattern for the content ViewModels and ensuring their proper disposal. The mock ViewModel types have also been made public to improve compatibility with XAML compiled bindings. The changes improve state management and resource handling. The suggestion regarding code organization for the newly added mock ViewModel classes to align with common C# best practices remains relevant.

@efargas efargas merged commit f0f1adc into audit/comprehensive-review-2025 Mar 8, 2026
0 of 12 checks passed
@efargas efargas deleted the feature/update-viewmodel-template-8714801939707767319 branch March 8, 2026 16:51
Comment on lines +264 to +285
#region Mock ViewModels

/// <summary>
/// Mock Overview ViewModel for design-time and initial implementation.
/// </summary>
public class [FEATURE_NAME]OverviewViewModel : ViewModelBase
{
}

/// <summary>
/// Mock Details ViewModel for design-time and initial implementation.
/// </summary>
public class [FEATURE_NAME]DetailsViewModel : ViewModelBase
{
}

/// <summary>
/// Mock Settings ViewModel for design-time and initial implementation.
/// </summary>
public class [FEATURE_NAME]SettingsViewModel : ViewModelBase
{
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Template creates duplicate vms 🐞 Bug ✓ Correctness

The template now defines public stub child ViewModel types
([Feature]Overview/Details/SettingsViewModel) in the same file, while the integration checklist
instructs creating those same types as separate files—following the checklist will cause
duplicate-type compilation errors. This is a high-likelihood blocker because the README/checklist
explicitly tells devs to copy this template into src/ where it will be compiled.
Agent Prompt
## Issue description
The FeatureViewModel template now declares public stub child ViewModel classes (`[Feature]OverviewViewModel`, `[Feature]DetailsViewModel`, `[Feature]SettingsViewModel`) in the same file. The UI integration checklist also instructs developers to create those child ViewModels as separate files, which will produce duplicate-type compile errors when someone follows the documented workflow.

## Issue Context
This template is intended to be copied into `src/` (per README), so its contents will compile as part of the app.

## Fix Focus Areas
- docs/templates/ui-integration/FeatureViewModel.template.cs[264-285]
- docs/templates/ui-integration/INTEGRATION_CHECKLIST.md[34-49]
- docs/templates/ui-integration/README.md[67-82]

## Suggested changes
- Preferred: Change the mock/stub child ViewModel declarations to `public partial class ...` and update the checklist to explicitly instruct creating `partial` implementations in separate files (or extending these partial stubs), avoiding CS0101 duplicate-type errors.
- Alternative: Remove the stub child ViewModels from the main template and add separate templates/files for child ViewModels, updating the checklist/README to match.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant