ColinFay / gargoyle

Event-Based Structures for 'Shiny'
Other
55 stars 7 forks source link

The "watch" function is not working properly #7

Closed rafaelcardosoargus closed 1 year ago

rafaelcardosoargus commented 1 year ago

Making shiny dashboards, using golem, it was working fine, but then, in a new shiny dashboard, also using golem, now this occurs:

--- in app_server.R:
...
gargoyle::init("ggl_test")
...
--- in mod_1_server:
...
gargoyle::trigger("ggl_test")
...
--- in another mod:
...
gargoyle::on("ggl_test", {
    print("ok1") # this runs only when calling mod_1_server (expected behavior)
})
shiny::observeEvent(gargoyle::watch("ggl_test"), {
    print("ok2") # this runs when calling mod_1_server but also when the app starts (before calling mod_1_server) - not supposed to happen 
})
ColinFay commented 1 year ago

ObserveEvent are run by default when an app is launched. Can you try adding "ignoreInit = TRUE" to your observeEvent ?

ColinFay commented 1 year ago

Ok, so back to this.

The behavior you're seeing is actually the correct one :

So this is the expected behavior :)

Best,

Colin

rafaelcardosoargus commented 1 year ago

Hi Colin,

You are right. I didn’t see this parameter at that time. Thanks!

Rafael Cardoso

From: Colin Fay @.> Sent: Monday, March 27, 2023 12:00 PM To: ColinFay/gargoyle @.> Cc: Rafael Cardoso @.>; Author @.> Subject: Re: [ColinFay/gargoyle] The "watch" function is not working properly (Issue #7)

Notice: external email – please use caution.


Ok, so back to this.

The behavior you're seeing is actually the correct one :

So this is the expected behavior :)

Best,

Colin

— Reply to this email directly, view it on GitHubhttps://github.com/ColinFay/gargoyle/issues/7#issuecomment-1485273983, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2SLHQTAZH5NUMXROWJXAPDW6GTNXANCNFSM6AAAAAAVML3SI4. You are receiving this because you authored the thread.Message ID: @.***>

The information contained in this email and its attachments is confidential and may be the subject of professional or other privilege. It may not be disclosed to anyone else without consent from the Argus Media group. If you are not the intended recipient please notify the sender and destroy this email and its attachments immediately; please do not use, disclose, distribute, copy, print or rely on the contents of this email or its attachments. While the Argus Media group takes care to protect its systems from electronic virus attack or other harmful event, the Argus Media group gives no warranty that this email or its attachments are free of any virus or other harmful matter and accepts no responsibility for any loss or damage resulting from the recipient receiving, opening or using it or its attachments. Email is not a secure method of communication and email messages may be intercepted. Messages sent to and from the Argus Media group may be monitored, reviewed and/or processed in accordance with the Argus Media group’s policies, including for the purpose of ensuring compliance with legal and regulatory obligations. Translations of this email disclaimer are available in Japanese, Mandarin, German, Portuguese and Russian at www.argusmedia.com/disclaimer.

Argus Media Limited has moved offices. Please note our new address below:

Argus Media Limited, Lacon House, 84 Theobalds Road, London WC1X 8NL Registered in England and Wales, Company Registration No: 1642534 VAT Registration No: GB 229 7149 41