Skip to content

Fix the GoDAM Media Library breaking issues - #2048

Draft
KMchaudhary wants to merge 1 commit into
developfrom
fix/godam-media-libary
Draft

Fix the GoDAM Media Library breaking issues#2048
KMchaudhary wants to merge 1 commit into
developfrom
fix/godam-media-libary

Conversation

@KMchaudhary

Copy link
Copy Markdown
Collaborator

This pull request improves the reliability and correctness of the media library sidebar integration, especially in environments where multiple media modals can be open (such as the WordPress block editor, classic editor, and Elementor). The changes ensure the sidebar is mounted and unmounted at the right times and that UI state is only reset when all media modals are closed, preventing accidental loss of user context.

Media frame sidebar mounting and lifecycle improvements:

  • Refactored the sidebar mounting logic to retry until the correct menu is available, target the specific frame being opened, and unmount stale React roots to prevent memory leaks. The sidebar is now mounted on every frame open event, not just on construction, fixing issues where the sidebar would disappear on reopening the modal. [1] [2] [3] [4]

Robust UI state reset handling for multiple/nested modals:

  • Introduced logic to detect when any media modal is still open and only reset the sidebar's UI state and resync the WordPress media query when all modals are closed. This prevents the active folder selection from being wiped when closing nested modals. [1] [2] [3] [4] [5] [6]

Code cleanup and variable renaming:

  • Renamed variables from ELEMENTOR_MENU_* to MEDIA_FRAME_MENU_* to clarify that the logic applies to all media frames, not just Elementor. [1] [2]

These changes significantly improve the sidebar's stability and user experience in complex modal scenarios.

Mount the folder sidebar into the opened frame's own menu (retrying until
it renders) and hand React the exact root, instead of guessing the last
visible frame. Bind mounting to the frame  event so reused frames
restore the sidebar on reopen. Gate the modal-close reset so it only runs
once the last media modal closes, so a nested-modal close no longer wipes
the active folder selection mid-use.
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.

1 participant