-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix popup handlers and removing graphics #183
Fix popup handlers and removing graphics #183
Conversation
@@ -227,7 +227,13 @@ export function buildJsPopupTemplate(popupTemplateObject: DotNetPopupTemplate, v | |||
if (viewId !== null) { | |||
let view = arcGisObjectRefs[viewId] as View; | |||
if (hasValue(view)) { | |||
view.popup.on("trigger-action", async (event: PopupTriggerActionEvent) => { | |||
if (hasValue(triggerActionHandler)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to start to convert more null checks over to 'hasValue'? I see you have included this multiple times here and above, but still have the null checks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a good refactoring to do, to move to always using hasValue
.
@@ -1533,21 +1533,14 @@ public async Task SolveServiceArea(string serviceAreaUrl, double[] driveTimeCutO | |||
/// </param> | |||
public async Task RemoveGraphic(Graphic graphic) | |||
{ | |||
try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove the try/catch? just to match up with the other layer and graphic methods above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This try/catch was swallowing the exception and not exposing it to the end user, even though there was a real problem. I sometimes intentionally swallow exceptions when they are caused by say a user navigating away from the map, but in this case it was misguided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good one question about the hasValue vs null checks.
Closes #181
Closes #182
Allows user to remove a graphic successfully from the
MapView
Prevents multiple registrations of the event handler in a
PopupWidget
orPopupTemplate