Skip to content

The nested component inherits the parent context data even without explicit parameter passing. #579

Open
@mahmoud-alawad

Description

@mahmoud-alawad

Describe the bug
Nested components unexpectedly have access to the parent component's context data, even when no parameters or props are explicitly passed to them. This causes unexpected behavior and potential data leakage, leading to unintended side effects in the application.

To Reproduce
Steps to reproduce the behavior:

  1. Create a parent component with some context-based data or state.
  2. Add a nested component inside the parent component.
  3. Without passing any props or parameters, try to access the parent context from the nested component.
  4. Observe that the nested component can access the parent context data.

Expected behavior
The nested component should not have access to the parent context data unless explicitly passed via props or another intentional mechanism.

Screenshots
2024-11-21_14-11

To prevent the issue in the example, the element property must be explicitly passed across all project files, ensuring consistent behavior and avoiding unintended context sharing. as down here

2024-11-21_14-12

The context must be reset at the root level each time the component is rendered to ensure a clean state and prevent unintended data persistence across renders.

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