Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Add existing TaskList component to new home screen #4378

Merged
merged 11 commits into from
May 21, 2020

Conversation

jeffstieler
Copy link
Contributor

@jeffstieler jeffstieler commented May 14, 2020

Progress towards #4096

This PR seeks to render the existing <TaskList /> component on the new home screen (before modifying it to suit the new designs).

A new TaskListPlaceholder component has been added to use during lazy load and API fetch.

It also modifies the test configuration to allow for dynamic import()s.

Accessibility

Screenshots

Screen Shot 2020-05-12 at 11 11 12 AM

Detailed test instructions:

  • Ensure the task list is enabled
  • Open the new home screen
  • Verify presence of Task List
  • Throttle network connection and disable cache
  • Refresh page
  • Verify placeholder renders while TaskList chunk loads
  • Enter an individual task
  • Verify only the task is displayed

Changelog Note:

@jeffstieler jeffstieler added [Status] Needs Review focus: home screen Issues around the new home screen feature labels May 14, 2020
@jeffstieler jeffstieler requested review from psealock and a team May 14, 2020 19:59
Copy link
Collaborator

@psealock psealock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well, code looks good. I made a few minor comments and have a question about preloading the option so we don't have to have a placeholder.

if ( isOnboardingEnabled() ) {
const options = getOptions( [
'woocommerce_task_list_hidden',
] );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we pre-load this option? It seems like holding off on render while waiting for this request is unnecessary. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can preload this option but that doesn't remove the need for the placeholder - it's in use as the Suspense fallback as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, 👍 to preloading

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is already preloaded:

$options[] = 'woocommerce_task_list_hidden';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that file getting loaded on the homescreen route? I think we do conditional loading of OBW logic. I haven't fired this one up, but I remember it waiting on this option to be fetched.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, that option is available at wcSettings.preloadOptions.woocommerce_task_list_hidden.

I'll take a closer look today.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its some kind of wc-api thing because if I hard code the values, then it renders as soon as the chunk has arrived. This looks fine to me, #4144 will ensure the preloaded option is available immediately.


const TaskListPlaceholder = ( props ) => {
const {
numTasks = 5,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: May as well destructure in the function's argument list

numTasks = 5,
} = props;
return (
<div className="woocommerce-task-dashboard__container">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this class name?

Suggested change
<div className="woocommerce-task-dashboard__container">
<div className="woocommerce-task-list__container">

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/js/jest.config.json Show resolved Hide resolved
@psealock psealock added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed [Status] Needs Review labels May 15, 2020
export default compose(
withSelect( ( select ) => {
const {
getOptions,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just an FYI that this is getting refactored in #4144. If this is merged first, I'll update the code.

@jeffstieler jeffstieler force-pushed the add/4096-home-screen-task-list branch from 42d813e to d7246f9 Compare May 20, 2020 17:46
Copy link
Collaborator

@psealock psealock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great @jeffstieler ! Working well and code looking good.

@psealock psealock added [Status] Ready to Merge and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels May 20, 2020
@jeffstieler jeffstieler force-pushed the add/4096-home-screen-task-list branch 2 times, most recently from 8523236 to 038cef8 Compare May 21, 2020 17:03
@jeffstieler jeffstieler merged commit 4cf137f into master May 21, 2020
@jeffstieler jeffstieler deleted the add/4096-home-screen-task-list branch May 21, 2020 17:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: home screen Issues around the new home screen feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants