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

Issue 104 Fix. ContextMenu trying to render inside constructor #147

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

tbytnar
Copy link
Contributor

@tbytnar tbytnar commented Nov 5, 2024

Type
What type of pull request is this? (e.g., Bug fix, Feature, Refactor, etc.)

  • Bug fix
  • Feature
  • Refactor
  • Other (please describe):

Description
The ListComponents were calling the .create() method of AppContextMenu before their own element objects were fully initialized. This caused the error as .AppendChild was clearly not available inside of the ContextMenu create() method. I've changed this functionality to take place in _onRender instead of _onInitialize to ensure better timing of the element initializations. I also implemented some cleanup methods _onDestroy in the ListComponents which properly cleans up their ContextMenus, Thanks Claude!

Related Issue
Fixes Issues #104

How Has This Been Tested?
Opening, closing and opening a character sheet any number of times. Also adding objects to each of the lists still saves and reloads on subsequent restarts of Foundry.

Checklist:

  • I have commented on my code, particularly in hard-to-understand areas.
  • My changes do not introduce any new warnings or errors.
  • My PR does not contain any copyrighted works that I do not have permission to use.
  • I have tested my changes on Foundry VTT version: 12.331.

@stanavdb stanavdb merged commit 646b78f into the-metalworks:release-0.1.2 Nov 5, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants