Closed jccartwright closed 2 years ago
Added a button and handler to subscriber-demo (line 41) which demonstrates problem in a simpler context than h2-layer
Looked into subscriber demo today. Tried a handful of alternative approaches and didn't sort it. Will reach out to the team on it.
The code within the onExecute
function's MessageType.DataSourceFilterChange
case branch is specific to having the Filter widget configured against it. Lines 44 and 45 of message-handler-action.ts
stand up a const
, then use that const
to execute the appAction.widgetStatePropChange
API method. There we can obtain the queryParams
through the change.
If you configure the Filter widget on the data source, then turn that on, you will see the query params in your UI's "Filter:" row and it will display in the alert message.
created a new experience and the subscriber-demo appears to be correctly accessing the widgetState in an event handler. The h3-layer is still not however. The widgetState.queryParams appear to be reset between line 58 and line 66. Either that or displayHexbinSummary is forming a closure over the original (empty) value and hiding the changed value.
Your comment above is related to #7, yes?
Your comment on l62, do you mean l58? I'm seeing it logged in the widgetState
object?
Yes, the 2 issues are related. For the client-side layer (either feature or graphics) I need to be able to: 1) grab the attributes from the individual feature receiving the click 2) react to changes in the queryParams and have access to the current queryParams in the click handler.
The click handler needs both pieces of information to summarize the selected hexbin
It appears that the queryParams are always empty in the click handler. Not sure if that is because it is the initial state (i.e. when function defined) or whether the widgetState is getting reset somewhere between the component re-rendering on datasourcefilterchange and the click handler.
On Sep 12, 2022, at 2:56 PM, Shawn Goulet @.***> wrote:
Yes, I see what you're talking about. Am looking into this. This is related to #7 https://github.com/jccartwright/exb-widgets/issues/7, yes?
I'm not seeing an error, it's just that the widgetState.queryParams is always '', yes?
— Reply to this email directly, view it on GitHub https://github.com/jccartwright/exb-widgets/issues/14#issuecomment-1244316356, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHAEBR23RMQ2WFAPNS6Y6TV56DHZANCNFSM6AAAAAAQHED5PY. You are receiving this because you authored the thread.
Just pushed a simple test to h3-layer where storing the widgetState.queryParams with useRef appears to work. Can’t really explain why though...
On Sep 12, 2022, at 3:49 PM, John Cartwright @.***> wrote:
Yes, the 2 issues are related. For the client-side layer (either feature or graphics) I need to be able to: 1) grab the attributes from the individual feature receiving the click 2) react to changes in the queryParams and have access to the current queryParams in the click handler.
The click handler needs both pieces of information to summarize the selected hexbin
It appears that the queryParams are always empty in the click handler. Not sure if that is because it is the initial state (i.e. when function defined) or whether the widgetState is getting reset somewhere between the component re-rendering on datasourcefilterchange and the click handler.
On Sep 12, 2022, at 2:56 PM, Shawn Goulet @. @.>> wrote:
Yes, I see what you're talking about. Am looking into this. This is related to #7 https://github.com/jccartwright/exb-widgets/issues/7, yes?
I'm not seeing an error, it's just that the widgetState.queryParams is always '', yes?
— Reply to this email directly, view it on GitHub https://github.com/jccartwright/exb-widgets/issues/14#issuecomment-1244316356, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHAEBR23RMQ2WFAPNS6Y6TV56DHZANCNFSM6AAAAAAQHED5PY. You are receiving this because you authored the thread.
closing in favor of the more focused issue #23
See widget.tsx lines 53, 57. Data are visible when component runs but not within view click handler