Skip to content
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

Map.OlMap memory leaks and event re-attaching. #406

Open
Drahness opened this issue Feb 17, 2025 · 4 comments
Open

Map.OlMap memory leaks and event re-attaching. #406

Drahness opened this issue Feb 17, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@Drahness
Copy link

Describe the bug

Where a instance is given to OlMap vue component, it attaches handles for all events even if when are not used by the consumer, it causes overhead emitting events with no purpose, in the worst case, if an instance is used in more than once can cause multiple events to fire with undefined behaviour.

Affected version(s)

+-- ol-contextmenu@5.5.0
+-- ol-ext@4.0.25
+-- ol@10.3.1
+-- vue@3.5.13
`-- vue3-openlayers@11.3.0

To Reproduce
Steps to reproduce the behaviour:

  • Mount a Map.OlMap component a condition and with a given 'instance' not controlled by vue3-openlayers.
  • Change the condition to force a remount of the Vue component, calling the "on" method in all event types of OpenLayers Map.
  • Repeat.

Expected behaviour

Handler functions added from Map are properly disconnected when Map.OlMap Vue component is dismounted, if an event is not used, do not call to the on method in the map instance. This logic can be applied to vue3-openlayers controlled "Map" instances.

Screenshots
Current code:

Image

Crappy solution:

Image

Platform

  • All platforms

Additional context

I saw in "src/composables/useOpenLayersEvents.ts" has a good function to attach that logic, I posted this issue because I cannot run locally the project and I doesn't found a guide to do so.

Thank you.

@Drahness Drahness added the bug Something isn't working label Feb 17, 2025
@d-koppenhagen
Copy link
Collaborator

@Drahness do you want to contribute? How did you try to run the project locally? I think a manual could be added. Basically you should:

  • Fork the project
  • clone the code locally
  • npm i
  • npm run docs:dev

I am happy to assist you.

@Drahness
Copy link
Author

Hello @d-koppenhagen , yes I want to contribute, I'll want to use this lib in my projects.

Thank you, I was struggling thinking my environment was wrong. Now runs as expected. I was trying with npm run serve first.

Thank you. Any tip or idea to start contributing? When committing in my fork I must follow any code standards?

d-koppenhagen added a commit that referenced this issue Feb 19, 2025
@d-koppenhagen
Copy link
Collaborator

Hey @Drahness , I updated the Contribution info (see: CONTRIBUTING.md)

@Drahness
Copy link
Author

Thank you! I will give it a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants