enuchi / React-Google-Apps-Script

This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.
MIT License
1.32k stars 171 forks source link

How can I communicate between ModalDialog and Sidebar? #187

Open saurav-bhagat opened 1 year ago

saurav-bhagat commented 1 year ago

I am opening a modal Dialog from sidebar on a button click, as we perform some activity in dialog modal, I want to know that in sidebar code.

Or even when we close the dialog, is there any way to know that in sidebar?

YvanJAquino commented 1 year ago

You'd normally use the google.script.run API, but I can't seem to compile and push ANYTHING with google.script.run - the result for me is 'ReferenceError' google is not defined.

I've attempted to use the gas-client library that this provides and, unfortunately, I'm either using it wrong (and it's side-stepping Typescript) or it's not working as desired.

Rulowizard commented 1 year ago

Any news on how to communicate between "windows"?

dandgerson commented 1 year ago

Hi, it's my case. It's work for me with just call the api from sidebar

  <Button
    variant="outlined"
    onClick={() => serverFunctions.openDialogMUI()}
  >
    Make SQL
  </Button>

But how we can message the sidebar when modal is close, i have no idea yet =) maybe dispatch some action?)

Rulowizard commented 12 months ago

Has anyone found a way to pass information between modal and sidebars?

rahools commented 4 months ago

I think this might be helpful https://github.com/enuchi/React-Google-Apps-Script/issues/209#issuecomment-1962322152