Skip to content

[v3] window._wails.dispatchWailsEvent is undefined on "Reload" #4872

@smahs

Description

@smahs

Description

Reloading a page on the frontend should cleanly reload like in browser. However there seems a race condition where in, likely, the WindowLoadFinished event is fired before the _wails is mounted on the window global. Future events are delivered fine, suggesting its likely a timing issue.

To Reproduce

  1. Create a new v3 project with: wails3 init -n app
  2. Run the app: cd app && wails3 dev
  3. Right click and click "Reload" on the frontend window.
  4. See the error on the console:
    TypeError: window._wails.dispatchWailsEvent is not a function. (In 'window._wails.dispatchWailsEvent({"name":"linux:WindowLoadFinished","data":null})', 'window._wails.dispatchWailsEvent' is undefined)
    

Expected behaviour

The page should be cleanly loaded without the above error. The initial load doesn't show the error.

Screenshots

No response

Attempted Fixes

No response

System Details

Wails (v3.0.0-alpha.57)  Wails Doctor

# System

┌────────────────────────────────────────────────────────────────────────────────────────────┐
| Name                | Arch Linux                                                           |
| Version             | Unknown                                                              |
| ID                  | arch                                                                 |
| Branding            |                                                                      |
| Platform            | linux                                                                |
| Architecture        | amd64                                                                |
| Desktop Environment | GNOME                                                                |
| NVIDIA Driver       | N/A                                                                  |
| XDG_SESSION_TYPE    | wayland                                                              |
└────────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment

┌────────────────────────────────────┐
| Wails CLI    | v3.0.0-alpha.57     |
| Go Version   | go1.25.5 X:nodwarf5 |
| -buildmode   | exe                 |
| -compiler    | gc                  |
| CGO_CFLAGS   |                     |
| CGO_CPPFLAGS |                     |
| CGO_CXXFLAGS |                     |
| CGO_ENABLED  | 1                   |
| CGO_LDFLAGS  |                     |
| GOAMD64      | v1                  |
| GOARCH       | amd64               |
| GOEXPERIMENT | nodwarf5            |
| GOOS         | linux               |
└────────────────────────────────────┘

# Dependencies

┌───────────────────────────────────────────────────────────────────────────────────────────────────┐
| gcc        | 15.2.1+r301+gf24307422d1d-1                                                          |
| gtk3       | 1:3.24.51-1                                                                          |
| npm        | 11.6.4                                                                               |
| pkg-config | 2.5.1-1                                                                              |
| webkit2gtk | 2.50.4-1                                                                             |
| docker     | *nerdctl version 2.2.1 (wails-cross image not built - run: wails3 task setup:docker) |
|                                                                                                   |
└───────────────────────────────────── * - Optional Dependency ─────────────────────────────────────┘

# Checking for issues

 SUCCESS  No issues found

# Diagnosis

 SUCCESS  Your system is ready for Wails development!

Need documentation? Run: wails3 docs
 ♥   If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions