Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StoryIndex: Detect added/moved directories and batch invalidations #16432

Merged
merged 3 commits into from
Oct 21, 2021

Conversation

tmeasday
Copy link
Member

@tmeasday tmeasday commented Oct 21, 2021

Issue:#16295

What I did

  • Added some code to handle a directory added/moving as watchpack only gives us an event for the entire directory, not each file within it.

I use the files glob to scan the directory. This may be a mistake--perhaps I should just scan all files in the directory. What do you think? (this would be a rare event)

  • Debounced the INVALIDATE event, so it fires at most twice, at least if watchpack events fire with no gap larger than 50ms.

How to test

  1. Run react TS
  2. Move the src/addon-docs directory [optionally add some more files in there too].
  3. Check the stories haven't been lost in the UI
  4. Check the INVALIDATE event only fired twice and stories.json was only fetched 4 times (2x2[manager+preview]).
  • Is this testable with Jest or Chromatic screenshots?

Yes we have tests

We send a leading one (to handle the fast path) and then a trailing one when events are done
@tmeasday tmeasday requested review from shilman and ndelangen October 21, 2021 07:21
@nx-cloud
Copy link

nx-cloud bot commented Oct 21, 2021

Nx Cloud Report

CI ran the following commands for commit 1cbf548. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Nice. This is awesome, and great tests too!! 💪 💪 💪

@shilman shilman added the core label Oct 21, 2021
@shilman shilman merged commit 85f5d05 into next Oct 21, 2021
@shilman shilman deleted the 16237-batch-invalidations branch October 21, 2021 08:15
@shilman shilman added this to the 6.4 PRs milestone Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants