Skip to content

Conversation

@ikoamu
Copy link
Contributor

@ikoamu ikoamu commented Mar 24, 2025

Hello. I found a bug in v1.2.0.

When GAS is deployed as a simple web application that is not on a Google Docs or Sheets dialog or sidebar, the following error occurs because google.script.host.editor is undefined:

userCodeAppPanel:104 Uncaught TypeError: Cannot read properties of undefined (reading 'focus')
    at A.initializeScriptHostFunctions (userCodeAppPanel:104:3469)
    at new A (userCodeAppPanel:104:3202)
    at new H (userCodeAppPanel:104:19612)
    at userCodeAppPanel:104:20319

Therefore, I've implemented optional chaining so that errors no longer occur even when google.script.host.editor is undefined.

@enuchi
Copy link
Owner

enuchi commented Mar 24, 2025

Thanks for catching this @ikoamu and for the fix. I published this as a prerelease for testing: [email protected]. Do you mind installing it with your webapp project and seeing if it works as expected?

@ikoamu
Copy link
Contributor Author

ikoamu commented Mar 25, 2025

@enuchi
Perfect. I've confirmed that it works without any issues with version 1.2.1-pr.1.
Thank you for the quick response and for adding the tests!

@enuchi enuchi merged commit 8044dd8 into enuchi:main Mar 25, 2025
3 checks passed
@enuchi
Copy link
Owner

enuchi commented Mar 25, 2025

Now published as 1.2.1. Thanks for the help on this one @ikoamu!

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