这是indexloc提供的服务,不要输入任何密码
Skip to content

chore(turbo_json): remove exterior mutability from loader #10066

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

Merged
merged 6 commits into from
Mar 3, 2025

Conversation

chris-olszewski
Copy link
Member

Description

TurboJsonLoader::load only took a mutable self reference because we were using HashMap to cache the results. This PR changes the data type we use to cache results and removes the exterior mutability.

We move to use a FixedMap which has the following properties:

  • Only works with the keys provided at construction
  • Append only
  • Thread safe

I went with this just because the implementation is straightforward and matches our use case since we know all of the possible places a turbo.json will be before we start loading them.

Future work can be reworking boundaries code to no longer eagerly load all of the turbo.jsons at the start of execution.

Testing Instructions

Existing test suite. Additional unit tests for FixedMap

Copy link

vercel bot commented Mar 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 3, 2025 10:37pm

@chris-olszewski chris-olszewski marked this pull request as ready for review March 3, 2025 12:31
@chris-olszewski chris-olszewski requested a review from a team as a code owner March 3, 2025 12:31
Co-authored-by: Nicholas Yang <nicholas.yang@vercel.com>
@chris-olszewski chris-olszewski merged commit ad8b821 into main Mar 3, 2025
38 checks passed
@chris-olszewski chris-olszewski deleted the olszewski/chore_hide_turbo_loader_mut branch March 3, 2025 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants