Skip to content

[Bug] Add additional elements to other context queue in event listener for "NewDataEvent" lead to inconsistent data provider #105

@hitsoul11

Description

@hitsoul11

Bug Description

When using DataProviders in combination with event listeners (specifically the "NewDataEvent"). The same DataProvider instance is being reused across different contexts with different options, leading to incorrect behavior.

Current Behavior

  1. A DataProvider instance (trinity_data) is configured with specific options for the main process (ProcessResourceHandler)
  2. During this process, a "NewDataEvent" is triggered
  3. The event listener adds additional elements (linked in the current element) to different contexts (name it "resource"). So, temporarily the data provider "trinity_data" is reinitialized in ResourceValidator::validateResource() with the options of the "resource" context
  4. After the event listener completes, the subsequent processing of previously queued items continues with the wrong (modified, "resource") DataProvider configuration
public function onNewDataAvailable(NewDataEvent $event): void
{
        // Event fired for an element for context "page"

        [...]
        $contextName = "resource";

        $this->dataCollector->addToContextQueue($contextName, $dispatchType, $asset);

        [...]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions