Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] (quick fix) ReferenceError: Can't find variable: OnMultiple #1388

Closed
lambdajack opened this issue May 9, 2022 · 5 comments · Fixed by #1390
Closed

[v2] (quick fix) ReferenceError: Can't find variable: OnMultiple #1388

lambdajack opened this issue May 9, 2022 · 5 comments · Fixed by #1390
Labels
Bug Something isn't working

Comments

@lambdajack
Copy link

Description

When calling EventsOn or EventsOnce (defined in frontend/wailsjs/runtime/runtime.js) on the frontend, they in turn make calls to OnMultiple which does not exist.

It should be EventsOnMultiple.

When manually changing runtime.js to use EventsOnMultiple the programme compiles and runs as expected. wails build works as expected if changing the file just before compilation.

wails dev rebuilds runtime.js when it detects changes. This causes any manual changes made to be effectively reversed and the functions go back to erroneously calling OnMultiple instead of EventsOnMultiple

Testing using wails init -n projectname -t vanilla-ts & ... react-ts & ... svelte-ts

To Reproduce

  1. wails init -n wailsisawesome -t react-ts
  2. wails dev
  3. (optional to test working change later) set up an event in the go backend (runtime.EventsEmit(...)) to fire every second emitting some data (I tested using a string)
  4. set up a frontend listener with EventsOn(...) in the already created App.tsx.

The app will fail to compile as the frontend cannot find OnMultiple.

  1. manually change ONLY the runtime.js file as described above (only this so as not to re-trigger an entire recompilation by wails dev which would override the manual changes.

The app now works as expected, receiving emitted events and corresponding data.

Expected behaviour

Calling OnEvents in the frontend should listen to events by correctly calling EventsOnMultiple instead of OnMultiple

Screenshots

No response

Attempted Fixes

When manually changing runtime.js to use EventsOnMultiple the programme compiles and runs as expected.

System Details

Wails CLI v2.0.0-beta.36


Scanning system - Please wait (this may take a long time)...Done.

System
------
OS:             Ubuntu
Version:        22.04
ID:             ubuntu
Go Version:     go1.18.1
Platform:       linux
Architecture:   amd64

Wails
------
Version:                v2.0.0-beta.36
Package Manager:        apt

Dependency      Package Name            Status          Version
----------      ------------            ------          -------
*docker         docker.io               Installed       20.10.14
gcc             build-essential         Installed       11.2.0
libgtk-3        libgtk-3-dev            Installed       3.24.33-1ubuntu1
libwebkit       libwebkit2gtk-4.0-dev   Installed       2.36.0-2ubuntu1
npm             npm                     Installed       8.9.0
*nsis           nsis                    Installed       v3.08-2
pkg-config      pkg-config              Installed       0.29.2

* - Optional Dependency

Diagnosis
---------
Your system is ready for Wails development!


If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony


### Additional context

_No response_
@lambdajack lambdajack added the Bug Something isn't working label May 9, 2022
@lambdajack
Copy link
Author

I am happy to make a fix and submit a pr for this - I am actively using Wails at the moment so would be glad to get it done as a priority.

@leaanthony
Copy link
Member

It's already fixed on master 👍

@lambdajack
Copy link
Author

Oh right.. Any chance you can post a link to the latest? I have pulled the master and it still has the old definitions? - am I looking in the wrong place?

@leaanthony
Copy link
Member

This issue is driving me crazy. I swear I've fixed this twice already 🤣🤣 If you can get a PR in the next hour, I'll merge. If not I'll do it (again?) myself 👍

@lambdajack
Copy link
Author

Haha - I've been there - PR on the way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants