Skip to content

fix(plugin-cloud-storage): prevent memory leak with multiple collections (#16039)#16163

Open
deepshekhardas wants to merge 1 commit intopayloadcms:mainfrom
deepshekhardas:fix/16039-memory-leak-cloud-storage
Open

fix(plugin-cloud-storage): prevent memory leak with multiple collections (#16039)#16163
deepshekhardas wants to merge 1 commit intopayloadcms:mainfrom
deepshekhardas:fix/16039-memory-leak-cloud-storage

Conversation

@deepshekhardas
Copy link
Copy Markdown
Contributor

Description

Fixes #16039 - Memory leak when using multiple collections in a cloud storage plugin

Problem

When multiple collections are used in a cloud storage plugin configuration, initClientUploads causes a memory leak that crashes the browser tab or freezes the computer.

Root Cause

Each collection was creating its own admin provider component, leading to excessive React component creation when many collections were configured.

Solution

Changed from creating one provider per collection to a single provider with a collectionsConfig map containing all collection configurations.

Changes

  • packages/plugin-cloud-storage/src/utilities/initClientUploads.ts: Build collectionsConfig map and push single provider

Testing

  • Verified admin loads correctly with 20+ collections
  • Memory usage remains stable

…ons (payloadcms#16039)

Changed from creating one provider per collection to a single provider with a collectionsConfig map.

This prevents browser memory leaks when using many collections with cloud storage.

Fixes payloadcms#16039
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