Skip to content

fix(v3/docs): correct invalid runtime sub-path imports#4989

Merged
leaanthony merged 5 commits into
v3-alphafrom
fix/docs-runtime-imports
Feb 28, 2026
Merged

fix(v3/docs): correct invalid runtime sub-path imports#4989
leaanthony merged 5 commits into
v3-alphafrom
fix/docs-runtime-imports

Conversation

@leaanthony

@leaanthony leaanthony commented Feb 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Fixed all invalid @wailsio/runtime/<subpath> imports in the Frontend Runtime and Overview documentation pages
  • The @wailsio/runtime package.json exports field only allows . and ./plugins/*, so sub-path imports like @wailsio/runtime/dialogs, @wailsio/runtime/events, @wailsio/runtime/window, etc. don't resolve at runtime
  • Replaced direct function imports (e.g., import { Info } from '@wailsio/runtime/dialogs') with the correct namespace pattern (e.g., import { Dialogs } from '@wailsio/runtime' then Dialogs.Info(...))

Files Changed

  • docs/src/content/docs/reference/frontend-runtime.mdx — 18 code blocks updated
  • docs/src/content/docs/reference/overview.mdx — 1 code block updated

Test plan

  • Verify the import examples match the actual @wailsio/runtime package exports
  • Confirm @wailsio/runtime/plugins/vite (left unchanged) still works as expected
  • Review docs site renders correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated docs to show consolidated frontend runtime imports: use unified named imports (Events, Window, Clipboard, Dialogs, Screens, System).
    • Examples updated to call runtime APIs through these namespaces (event handling, clipboard, dialogs, window control, screens, system invoke).
    • Simplified examples and migration guidance to reflect v3 API and fixed incorrect import examples; removed conditional platform-branching in one events guide.

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>
Copilot AI review requested due to automatic review settings February 13, 2026 14:01
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

@coderabbitai

coderabbitai Bot commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3493d31 and 7383c4e.

📒 Files selected for processing (2)
  • docs/src/content/docs/reference/window.mdx
  • v3/UNRELEASED_CHANGELOG.md

Walkthrough

Documentation examples updated to use a consolidated @wailsio/runtime public API: event functions and per-module utilities are now referenced via namespaced objects (e.g., Events, Window, Clipboard, Dialogs, Screens, System) instead of standalone imports.

Changes

Cohort / File(s) Summary
Reference & Overview
docs/src/content/docs/reference/frontend-runtime.mdx, docs/src/content/docs/reference/overview.mdx, docs/src/content/docs/reference/events.mdx, docs/src/content/docs/reference/window.mdx
Replaced per-function imports (On, Once, Emit, Off, etc.) with Events namespace; updated imports to import { Events, Window, ... } from '@wailsio/runtime' and adjusted examples to Events.On/Once/Emit/Off/OffAll.
Concepts & Guides
docs/src/content/docs/concepts/architecture.mdx, docs/src/content/docs/concepts/bridge.mdx, docs/src/content/docs/guides/events-reference.mdx, docs/src/content/docs/migration/v2-to-v3.mdx
Updated code snippets to use Events instead of top-level event functions; removed platform-conditional registration in events-reference example.
Features: dialogs & events
docs/src/content/docs/features/dialogs/custom.mdx, docs/src/content/docs/features/events/system.mdx
Switched custom-dialog and events examples to Events namespace; replaced OnEvent/Emit usages with Events.On/Events.Emit.
Features: windows (frameless)
docs/src/content/docs/features/windows/frameless.mdx
Replaced individual window control functions with a single Window object and method calls (Window.Minimise(), Window.Maximise(), Window.Restore(), Window.IsMaximised(), Window.Close()); updated imports accordingly.
Contributing / Binding System
docs/src/content/docs/contributing/binding-system.mdx
Replaced direct invoke(...) usage with System.invoke(...) and updated import to System.
Changelog
v3/UNRELEASED_CHANGELOG.md
Added entry noting corrected @wailsio/runtime import examples across docs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

Documentation, v3-alpha, size:L, lgtm

Poem

🐰
I hopped through imports, tidy and spry,
Events and Window lined up in a line.
Clipboard & Dialogs in one neat stack,
Screens and System — no paths to track.
A little rabbit stamp, docs trimmed and fine. 🥕✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (13 files):

⚔️ docs/src/content/docs/concepts/architecture.mdx (content)
⚔️ docs/src/content/docs/concepts/bridge.mdx (content)
⚔️ docs/src/content/docs/contributing/binding-system.mdx (content)
⚔️ docs/src/content/docs/features/dialogs/custom.mdx (content)
⚔️ docs/src/content/docs/features/events/system.mdx (content)
⚔️ docs/src/content/docs/features/windows/frameless.mdx (content)
⚔️ docs/src/content/docs/guides/events-reference.mdx (content)
⚔️ docs/src/content/docs/migration/v2-to-v3.mdx (content)
⚔️ docs/src/content/docs/reference/events.mdx (content)
⚔️ docs/src/content/docs/reference/frontend-runtime.mdx (content)
⚔️ docs/src/content/docs/reference/overview.mdx (content)
⚔️ docs/src/content/docs/reference/window.mdx (content)
⚔️ v3/UNRELEASED_CHANGELOG.md (content)

These conflicts must be resolved before merging into v3-alpha.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing invalid runtime sub-path imports in documentation by updating them to use the correct namespace imports.
Description check ✅ Passed The description includes a clear summary of changes, the rationale for the fix, specific files modified, and a test plan covering verification of imports and documentation rendering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/docs-runtime-imports

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.

Copilot AI left a comment

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.

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>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 13, 2026

Copy link
Copy Markdown

Deploying wails with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7383c4e
Status:⚡️  Build in progress...

View logs

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

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.

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 | 🟡 Minor

Stale OffAll call on line 185.

The example on line 185 still uses bare OffAll('data-updated') but the import (line 177) only imports Events. This should be Events.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 be Events.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'

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.

⚠️ Potential issue | 🟡 Minor

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.

@leaanthony leaanthony merged commit b4b0b90 into v3-alpha Feb 28, 2026
9 of 12 checks passed
@leaanthony leaanthony deleted the fix/docs-runtime-imports branch February 28, 2026 05:08
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

Grantmartin2002 pushed a commit to Grantmartin2002/wails that referenced this pull request Apr 29, 2026
* 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>
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