Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.4k stars 1.98k forks source link

Extract Inline Help action thunk in favour of data layer. #42698

Open getdave opened 4 years ago

getdave commented 4 years ago

Instead of building on top of this thunk could we look into adding additional data-layer handling in client/state/data-layer/wpcom/help/search/index.js? Reach out to @dmsnell or Serenity if you had questions on this.

It's much harder to work with and inspect thunks over plain action objects

It'd be great to eventually remove the wpcom.undocumented(). getHelpLinks() usages, but that would require a number of Janitorial PR refactors.

Originally posted by @gwwar in https://github.com/Automattic/wp-calypso/pull/42625

getdave commented 4 years ago

@dmsnell Pinging you here as @gwwar suggested you might be able to offer advice on how we should approach the task of migrating thunk-based action code to "data-layer handling".

Here's the existing areas of code:

I'm not super familiar with the steps we could be taking here to migrate to a better system.

Happy to do my own reading/learning, but would really appreciate any high-level guidance on where I could be focusing my attention.

Very much appreciated.

gwwar commented 4 years ago

So priority on this is relatively low to untangle this, unless folks will be actively working here in the future. It is however nice for future developers, eg say a 5 min change to add another usage call vs spending half a day wrestling with thunks.

One of the first things I'd start with, is looking into if has any equivalent data-layer handling for the wpcom undocumented call.

wpcom.undocumented().getHelpLinks( searchQuery )

I made a similar janitorial update in https://github.com/Automattic/wp-calypso/pull/38866 (though ignore the tracks handling there as I had to preserve behavior). Feel free to DM if you're interested in tidying, I think I also have old slides on hand for overall data-layer concepts.

github-actions[bot] commented 3 years ago

This issue is stale because it has been 180 days with no activity. You can keep the issue open by adding a comment. If you do, please provide additional context and explain why you’d like it to remain open. You can also close the issue yourself — if you do, please add a brief explanation and apply one of relevant issue close labels.