Skip to content

Conversation

@promonteiro
Copy link

The issue:

  1. If the markerId was not found in the array, findIndex returns -1.
  2. The code then executes markerArr.splice(-1, 1).
  3. In JavaScript/TypeScript, passing a negative index to .splice() means "start from the end of the array."

Result: If the specific marker wasn't found, the code would accidentally delete the last marker in the array instead of doing nothing.

The Solution:

  1. It stores the result of the search in a variable (idx).
  2. It explicitly checks if idx is not equal to -1 (meaning the item actually exists).
  3. It only attempts to delete (splice) the item if it was found.

Summary: This PR prevents the accidental removal of the last map marker when trying to clean up a marker ID that no longer exists in the array.

@promonteiro promonteiro requested a review from a team as a code owner January 5, 2026 20:32
@gnbm
Copy link
Collaborator

gnbm commented Jan 5, 2026

Hello @promonteiro 👋
Thanks for your Pull Request. It looks like this may be your first contribution to an OutSystems Open Source project. Before we look into your contribution, we need you to accept the 📝 OutSystems Contributors License Agreement.
After you read and accept the terms of the agreement, reply to this message saying I read, understood and accept the OutSystems CLA.

After this step, we'll review your Pull Request and provide any feedback if needed.
Thank you and feel free to keep contributing! 🚀

@promonteiro
Copy link
Author

promonteiro commented Jan 5, 2026 via email

@outsystemsbot outsystemsbot bot added the cla:yes label Jan 5, 2026
@promonteiro
Copy link
Author

promonteiro commented Jan 5, 2026 via email

@gnbm gnbm self-requested a review January 8, 2026 15:48
Copy link
Collaborator

@gnbm gnbm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@promonteiro All commits on our repos are required to be signed

@promonteiro promonteiro force-pushed the fix/marker-manager-bugs-from-dev branch from 201a94c to cfa887e Compare January 8, 2026 17:27
@promonteiro promonteiro force-pushed the fix/marker-manager-bugs-from-dev branch from cfa887e to de74852 Compare January 8, 2026 17:36
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@promonteiro
Copy link
Author

Hey folks! Sorry for the noise on this PR. I haven’t used git in a while and I was a bit lost on how to properly sign the commits for the PR, so I had to force-push after re-signing. It should now be correctly signed/verified. Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants