jccartwright / exb-widgets

sandbox for custom widgets to be used in ArcGIS Experience Builder
0 stars 1 forks source link

after applying a layerDefinition, only draw filtered points #15

Open jccartwright opened 2 years ago

jccartwright commented 2 years ago

The layer-listener widget is designed to display the polygon layer at small scales unless a layerDefinition has been applied to the point layer. In that case, the visible property of the polygon layer is set to false and set to true for the point layer.

The problem is that when the layerDefinition is applied, the polygon layer turns off, all the points are drawn and only then are the filtered points drawn.

The widget is using a useEffect hook and should not be changing the visibility of any layer if the isUpdating property is true. I'm not sure if the problem is a logic error on my part or some aspect of the JSAPI.

The ideal behavior would be for the view to not draw the unfiltered points before drawing the filtered ones. Second best would be to allow the widget to wait until filtered points were drawn before making the points layer visible

shawnmgoulet commented 1 year ago

@jccartwright - could you confirm that what you describe above translates to what I am showing here on your end as far as behavior of the Map widget?

https://user-images.githubusercontent.com/3179974/191589929-d8cfe723-5344-40c3-93ed-22ff714a2332.mp4

Notice that there's the esri.views.2d.engine.webgl.AttributeStoreView > mapview-webgl error "Tried to update attribute data with a pending update" that looks to take place going from the zoom level just below the zoomLevelToggle (4 using the default setting of 5) to the zoomLevelToggle and then the other (above the zoomLevelToggle - 6 using the default setting) to the zoomLevelToggle zoom level.

I'm inclined to think this is a React/JSAPI implementation issue. The wrinkle is that it's within Experience Builder. Unfortunately, to prove that it is JSAPI, we'll need this code into a CodeSandbox or the like (outside of Experience Builder) to demonstrate the problem still exists stripped down to only React and JSAPI.

There isn't something that I see sticking out between your useEffect and activeViewChangeHandler implementation of watching the view's extent.

jccartwright commented 1 year ago

It’s a little hard to be sure from your example so I recorded what I’m seeing. Essentially what I’m looking for is a way to not display the points layer until the filtered points are drawn (approximately at the 1:13 mark in the video). I can’t help but think there’s some flaw in my logic which is hiding the polygon layer and showing the point layer prematurely, i.e. before the filtered points are ready.

Ideally I’d like to avoid drawing the unfiltered points entirely and only draw the filtered points.

shawnmgoulet commented 1 year ago

@jccartwright yes, like I said in the email, we need to tease out the issue and start with vanilla JS + JSAPI in a CodePen to see if the issue still presents itself.

There isn't a glaring issue, but that doesn't mean there isn't an issue.

jccartwright commented 1 year ago

Gotcha - I’ll work on that

On Sep 21, 2022, at 3:15 PM, Shawn Goulet @.***> wrote:

@jccartwright https://github.com/jccartwright yes, like I said in the email, we need to tease out the issue and start with vanilla JS + JSAPI in a CodePen to see if the issue still presents itself.

There isn't a glaring issue, but that doesn't mean there isn't an issue.

— Reply to this email directly, view it on GitHub https://github.com/jccartwright/exb-widgets/issues/15#issuecomment-1254235679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHAEBRV2MDREMZRS7334BDV7N3H5ANCNFSM6AAAAAAQHE4S4U. You are receiving this because you were mentioned.

shawnmgoulet commented 1 year ago

updated

@jccartwright - correct me if I'm wrong, but the logic used in this CodePen may provide a fix for all/some issues we're seeing in this widget? (lines 51-53 for watching the view's stationary property & lines 55-61 watching extent changes)

This sample is pointing to the next version of the JSAPI which is planned to be released in November. Until then, I'm told there isn't a good workaround. The next version of the developer edition of Experience Builder would be released the ensuing month (planned for sometime after - later November or December).

Any modification (in this case a version update) of the version of the ArcGIS API for JS from what the developer edition of Experience Builder shipped with, makes the developer edition unsupported.