Skip to content

refactor: use context to share repository instances to avoid prop-drilling #878

@ChengShi-1

Description

@ChengShi-1

Overview of the Feature Request
In order to avoid prop-drilling, we could use context to share repository instances.

We could create a custom hook,useRepositories( ) for passing use cases, wrap everything inside its provider component. Storybook and Test files should also be modified to match the same pattern of use context.

There are some sample codes from German of making these changes in this branch -> develop...avoid-prop-drilling

What kind of user is the feature intended for?
(Example users roles: API User, Curator, Depositor, Guest, Superuser, Sysadmin)
SPA developers

What inspired the request?
prop-drilling through multiple layers increase complexity of the code, so it is a way to optimize

What existing behavior do you want changed?
Whenever we need to pass repository props to component

Any brand-new behavior do you want to add to Dataverse?
Nothing related to current user-faced UI or behavior

Any open or closed issues related to this feature request?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions