Skip to content

[v2] docs(menu): add imports and complete the example - #4727

Merged
leaanthony merged 3 commits into
wailsapp:masterfrom
agilgur5:fix-v2-menu-imports
Nov 30, 2025
Merged

leaanthony merged 3 commits into
wailsapp:masterfrom
agilgur5:fix-v2-menu-imports

Conversation

@agilgur5

@agilgur5 agilgur5 commented Nov 23, 2025 •

Copy link
Copy Markdown
Contributor

Description

Related to #4726

Fixes #NA

Type of change

This is a docs improvement / patch

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested on the Go Playground: https://go.dev/play/p/tcWdPSMRCji

  • Windows
  • macOS
  • Linux

Test Configuration

Go Playground. Also this is a docs-only change

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • [n/a] I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • [n/a] I have added tests that prove my fix is effective or that my feature works
  • [n/a] New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • Documentation
    • Enhanced menu creation guide with improved code examples featuring complete imports, main function implementation, and comprehensive error handling for better usability.

✏️ Tip: You can customize this high-level summary in your review settings.

- the example was missing imports, which [confused a user](https://stackoverflow.com/q/79827619/3431180), particularly due to the `rt` import alias
  - plus there are a good number of imports too, which this makes explicit
- it also didn't mention that it built on top of the `NewApp` / `app.go` scaffold, so mention and link to that as well
  - it wasn't clear where `NewApp` came from without that
  - give this file the title `menu.go` for clarity / explicitness
- also handle the error at the end similar to [existing examples](https://github.com/wailsapp/wails/blob/4c464b3092fff35b993f31ca62ca612399dde970/website/docs/guides/application-development.mdx?plain=1#L54)
@coderabbitai

coderabbitai Bot commented Nov 23, 2025 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@leaanthony has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between bccc72a and 66190b7.

📒 Files selected for processing (2)
  • website/docs/reference/menus.mdx (1 hunks)
  • website/src/pages/changelog.mdx (1 hunks)

Walkthrough

Updates the menu creation guide documentation to include a complete, runnable Go example using the NewApp scaffold with full imports, main function, and error handling after wails.Run.

Changes

Cohort / File(s) Summary
Documentation Examples Enhancement
website/docs/reference/menus.mdx
Enhanced menu creation example with complete runnable code using NewApp scaffold, including full imports, main function definition, and error handling with log.Fatal after wails.Run invocation

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Single file modification (documentation only)
  • Straightforward example code expansion and improvement
  • No logic changes or new features introduced

Possibly related PRs

  • Fixed example for macOS menu #3847: Modifies the same menus.mdx file to improve menu creation examples; this PR focuses on completeness while the related PR addresses macOS-specific menu setup and callbacks.

Suggested labels

size:S

Suggested reviewers

  • leaanthony

Poem

🐰 A snippet once bare, now shines with care,
With imports and mains, no holes laid bare!
Error logs bounce where the crashes might dare,
Runnable examples—a coder's delight to share! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding missing imports and completing the menu example in the documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description follows the template structure with all major sections filled in, including a clear description of the issue, type of change, testing approach, and mostly completed checklist.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@agilgur5 agilgur5 mentioned this pull request Nov 23, 2025
9 of 12 tasks
@sonarqubecloud

Copy link
Copy Markdown

Comment thread website/docs/reference/menus.mdx Outdated
"github.com/wailsapp/wails/v2/pkg/menu/keys"
"github.com/wailsapp/wails/v2/pkg/options"
rt "github.com/wailsapp/wails/v2/pkg/runtime"
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@leaanthony not sure if this was intentional, but all the imports (and the error check at the end) were removed in this merge commit, which undoes the bulk of the changes in this PR

@leaanthony
leaanthony merged commit cb3305a into wailsapp:master Nov 30, 2025
20 of 21 checks passed
@agilgur5

agilgur5 commented Nov 30, 2025 •

Copy link
Copy Markdown
Contributor Author

@leaanthony I think you missed my review comment above regarding what looked like an accidental merge conflict resolution that removed a large chunk of the code? I added that back in another PR: #4742

Also totally feel free to ask me to resolve any merge conflicts in my changes if you're not sure! In this case, this PR changed lines above and below those of #4726 so git conflicted due to the 1-line radius . The diffs are clearer when viewed as chronological, stacked PRs, but GH doesn't quite support that 😅

@agilgur5
agilgur5 deleted the fix-v2-menu-imports branch December 1, 2025 16:35
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.

2 participants