Automattic / Automattic/fresh-data

Move data handlers into constructor

Open
#210 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
37
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Previously, because the data handlers were external to fresh-data and typically props of a provider component, `setDataHandlers` was called whenever the props changed. However, since the ApiClient is basically re-created in most of those cases now, it makes sense to just include these data handlers in the constructor of ApiClient, etc. This came up in a PR review comment: https://github.com/Automattic/fresh-data/pull/202#pullrequestreview-259694818

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing ApiClient construction and the current setDataHandlers calls from provider components, using the linked PR review for context. Move the data handlers into the ApiClient and related constructors, then verify that prop changes no longer require separate handler updates.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.