fix(v3/docs): correct invalid runtime sub-path imports#4989
Conversation
The @wailsio/runtime package only exports "." and "./plugins/*" in its
package.json exports field. Documentation examples incorrectly used
sub-path imports like @wailsio/runtime/dialogs, /events, /window, etc.
which don't resolve at runtime. Updated all examples to use the correct
namespace import pattern (e.g., import { Dialogs } from '@wailsio/runtime').
Fixes wailsapp/wails#0000
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
WalkthroughDocumentation examples updated to use a consolidated Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR corrects invalid runtime sub-path imports in the Wails v3 documentation. The @wailsio/runtime package.json only exports . and ./plugins/*, making direct sub-path imports like @wailsio/runtime/events or @wailsio/runtime/window invalid at runtime. The fix replaces these with the correct namespace import pattern used throughout the codebase.
Changes:
- Replaced all invalid sub-path imports (e.g.,
@wailsio/runtime/events,@wailsio/runtime/window) with correct namespace imports (e.g.,import { Events, Window } from '@wailsio/runtime') - Updated all function call examples to use the namespace pattern (e.g.,
Events.On(),Window.SetTitle(),Clipboard.Text()) - Ensured consistency across 18 code blocks in frontend-runtime.mdx and 1 code block in overview.mdx
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/src/content/docs/reference/overview.mdx | Fixed import example to use correct namespace pattern for Events and Window |
| docs/src/content/docs/reference/frontend-runtime.mdx | Corrected all runtime import examples across Events, Window, Clipboard, Application, Browser, Screens, and Dialogs modules to use namespace imports instead of invalid sub-paths |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix imports that reference non-existent direct exports from @wailsio/runtime. The package exports namespace objects (Events, Window, Clipboard, etc.), not individual functions. Updated all docs to use the correct namespace pattern: - Events: On/Once/Off/OffAll/Emit → Events.On/Events.Emit/etc. - Window: WindowMinimise/WindowClose → Window.Minimise/Window.Close - Dialogs: OnEvent/Emit → Events.On/Events.Emit - System: invoke → System.invoke - Removed non-existent Platform import Files: events.mdx, frameless.mdx, system.mdx, custom.mdx, v2-to-v3.mdx, window.mdx, architecture.mdx, bridge.mdx, events-reference.mdx, binding-system.mdx Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/src/content/docs/reference/events.mdx (1)
177-186:⚠️ Potential issue | 🟡 MinorStale
OffAllcall on line 185.The example on line 185 still uses bare
OffAll('data-updated')but the import (line 177) only importsEvents. This should beEvents.OffAll('data-updated').Proposed fix
// Remove all listeners for this event -OffAll('data-updated') +Events.OffAll('data-updated')docs/src/content/docs/migration/v2-to-v3.mdx (1)
617-623:⚠️ Potential issue | 🟡 Minor"Events not firing" troubleshooting snippet still uses old API.
Line 622 shows
OnEvent("my-event", handler)as the v3 JavaScript fix, but this should beEvents.On("my-event", handler)to match the updated API documented elsewhere in this file and across the PR.Proposed fix
// JavaScript -OnEvent("my-event", handler) // Must match exactly +Events.On("my-event", handler) // Must match exactly
🤖 Fix all issues with AI agents
In `@docs/src/content/docs/features/events/system.mdx`:
- Line 509: The example mixes bare Emit(...) calls with an import that provides
Events, so replace the two bare calls to Emit (e.g., the calls that currently
read Emit("close-confirmed", true) and Emit("user-action", ...)) with
Events.Emit(...) to match the imported symbol; update the two occurrences to
call Events.Emit(...) where Emit is used so the example compiles and
consistently references the Events.Emit API.
|
|
||
| ```javascript | ||
| import { Events, Emit } from '@wailsio/runtime' | ||
| import { Events } from '@wailsio/runtime' |
There was a problem hiding this comment.
Inconsistent Emit usage in the Complete Example section below.
Lines 531 and 537 still use bare Emit(...) calls (e.g., Emit("close-confirmed", true) and Emit("user-action", ...)), but the import on line 509 only brings in Events. These should be updated to Events.Emit(...) to match.
Proposed fix (lines 531 and 537)
- Emit("close-confirmed", true)
+ Events.Emit("close-confirmed", true)- Emit("user-action", { action: "button-clicked" })
+ Events.Emit("user-action", { action: "button-clicked" })🤖 Prompt for AI Agents
In `@docs/src/content/docs/features/events/system.mdx` at line 509, The example
mixes bare Emit(...) calls with an import that provides Events, so replace the
two bare calls to Emit (e.g., the calls that currently read
Emit("close-confirmed", true) and Emit("user-action", ...)) with
Events.Emit(...) to match the imported symbol; update the two occurrences to
call Events.Emit(...) where Emit is used so the example compiles and
consistently references the Events.Emit API.
|
* fix(v3/docs): correct invalid runtime sub-path imports in documentation
The @wailsio/runtime package only exports "." and "./plugins/*" in its
package.json exports field. Documentation examples incorrectly used
sub-path imports like @wailsio/runtime/dialogs, /events, /window, etc.
which don't resolve at runtime. Updated all examples to use the correct
namespace import pattern (e.g., import { Dialogs } from '@wailsio/runtime').
Fixes wailsapp/wails#0000
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(v3/docs): correct invalid direct imports across remaining doc files
Fix imports that reference non-existent direct exports from
@wailsio/runtime. The package exports namespace objects (Events,
Window, Clipboard, etc.), not individual functions. Updated all
docs to use the correct namespace pattern:
- Events: On/Once/Off/OffAll/Emit → Events.On/Events.Emit/etc.
- Window: WindowMinimise/WindowClose → Window.Minimise/Window.Close
- Dialogs: OnEvent/Emit → Events.On/Events.Emit
- System: invoke → System.invoke
- Removed non-existent Platform import
Files: events.mdx, frameless.mdx, system.mdx, custom.mdx,
v2-to-v3.mdx, window.mdx, architecture.mdx, bridge.mdx,
events-reference.mdx, binding-system.mdx
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update UNRELEASED_CHANGELOG.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
@wailsio/runtime/<subpath>imports in the Frontend Runtime and Overview documentation pages@wailsio/runtimepackage.jsonexportsfield only allows.and./plugins/*, so sub-path imports like@wailsio/runtime/dialogs,@wailsio/runtime/events,@wailsio/runtime/window, etc. don't resolve at runtimeimport { Info } from '@wailsio/runtime/dialogs') with the correct namespace pattern (e.g.,import { Dialogs } from '@wailsio/runtime'thenDialogs.Info(...))Files Changed
docs/src/content/docs/reference/frontend-runtime.mdx— 18 code blocks updateddocs/src/content/docs/reference/overview.mdx— 1 code block updatedTest plan
@wailsio/runtimepackage exports@wailsio/runtime/plugins/vite(left unchanged) still works as expected🤖 Generated with Claude Code
Summary by CodeRabbit