Project-Pandora-Game / pandora

https://project-pandora.com
Other
11 stars 2 forks source link

[FIX] Move graphics draw props to callbacks #855

Closed Livie53 closed 2 weeks ago

Livie53 commented 2 weeks ago

References

Discussion of the issue https://discord.com/channels/872284471611760720/872568378190086174/1304895194172227674

About The Pull Request

Fixes a memory leak from RoomCharacter graphics draw not using useCallback as it should have.

Changelog

Authored by: Livie53

Platform changes:
- Improved performance of debug overlays

Checklist

Jomshir98 commented 2 weeks ago

This certainly is an efficiency improvement, but I would argue it isn't a memory leak and that it definitely doesn't affect normal users. 1) All the modified code is only used if debugConfig?.deviceDebugOverlay is true, which isn't the case for regular users 2) The effect of the functions being recreated and re-assigned each render of the parent component only means that the child needs to be updated and re-drawn more often. It still shouldn't affect the child before the change getting properly cleaned up - so no memory leak should occur.

Either way it is an improvement and I will look at it in more detail tomorrow, when I'm less sleepy.