Skip to content

chore(shared): change PatchFlagNames[PatchFlags.CACHED] from 'HOISTED' to 'CACHED' #12831

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 3 commits into from
Jun 5, 2025

Conversation

Arman19941113
Copy link
Contributor

@Arman19941113 Arman19941113 commented Feb 9, 2025

I'm not sure why PR #11067 didn't update the value of PatchFlagNames[PatchFlags.CACHED].

I attempted to change its value from 'HOISTED' to 'CACHED'.

Alternatively, should we update codegen.ts instead?

const patchFlagName = patchFlag === PatchFlags.CACHED ? 'CACHED' : PatchFlagNames[patchFlag]
patchFlagString = patchFlag + ` /* ${patchFlagName} */`

Given the template:

<template>
  <p>hello</p>
  <p>world</p>
</template>

Before:

export function render(_ctx, _cache) {
  return (_openBlock(), _createElementBlock("template", null, _cache[0] || (_cache[0] = [
    _createElementVNode("p", null, "hello", -1 /* HOISTED */),
    _createElementVNode("p", null, "world", -1 /* HOISTED */)
  ])))
}

After:

export function render(_ctx, _cache) {
  return (_openBlock(), _createElementBlock("template", null, _cache[0] || (_cache[0] = [
    _createElementVNode("p", null, "hello", -1 /* CACHED */),
    _createElementVNode("p", null, "world", -1 /* CACHED */)
  ])))
}

Summary by CodeRabbit

  • Refactor
    • Updated the label for a patch flag to improve clarity in displayed names.

@edison1105 edison1105 added ready to merge The PR is ready to be merged. 🧹 p1-chore Priority 1: this doesn't change code behavior. labels Feb 10, 2025
Copy link

github-actions bot commented Feb 10, 2025

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB 38.3 kB 34.5 kB
vue.global.prod.js 159 kB 58.5 kB 52.1 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.6 kB 18.2 kB 16.6 kB
createApp 54.5 kB 21.2 kB 19.4 kB
createSSRApp 58.8 kB 23 kB 20.9 kB
defineCustomElement 59.5 kB 22.8 kB 20.8 kB
overall 68.6 kB 26.4 kB 24.1 kB

Copy link

pkg-pr-new bot commented Feb 10, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@12831

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@12831

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@12831

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@12831

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@12831

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@12831

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@12831

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@12831

@vue/shared

npm i https://pkg.pr.new/@vue/shared@12831

vue

npm i https://pkg.pr.new/vue@12831

@vue/compat

npm i https://pkg.pr.new/@vue/compat@12831

commit: 960faac

@edison1105 edison1105 changed the title chore(shared): update patchFlagName chore(shared): change PatchFlagNames[PatchFlags.CACHED] from 'HOISTED' to 'CACHED' Feb 10, 2025
Copy link

coderabbitai bot commented Jun 4, 2025

Walkthrough

The update changes the string label for the PatchFlags.CACHED entry in the PatchFlagNames mapping from "HOISTED" to "CACHED" in the patchFlags.ts file. This ensures the human-readable name matches the enum identifier. No other code or logic is modified.

Changes

File Change Summary
packages/shared/src/patchFlags.ts Updated PatchFlagNames.CACHED from "HOISTED" to "CACHED"

Poem

A flag once called "HOISTED" is now "CACHED" instead,
With names aligned, confusion has fled.
In the patchwork of code, clarity’s grown,
As rabbits rejoice in the changes shown.
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

Progress: resolved 0, reused 0, downloaded 1, added 0
 WARN  GET http://10.0.0.28:4873/@vitest/eslint-plugin/-/eslint-plugin-1.2.1.tgz error (ERR_PNPM_FETCH_500). Will retry in 10 seconds. 2 retries left.
 WARN  GET http://10.0.0.28:4873/eslint-plugin-import-x/-/eslint-plugin-import-x-4.13.1.tgz error (ERR_PNPM_FETCH_500). Will retry in 10 seconds. 2 retries left.
 WARN  GET http://10.0.0.28:4873/typescript-eslint/-/typescript-eslint-8.32.1.tgz error (ERR_PNPM_FETCH_500). Will retry in 10 seconds. 2 retries left.
 ERR_PNPM_FETCH_404  GET http://10.0.0.28:4873/puppeteer/-/puppeteer-24.9.0.tgz: Not Found - 404

This error happened while installing a direct dependency of /tmp/eslint

No authorization header was set for the request.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e53a4ff and 0d4c29c.

⛔ Files ignored due to path filters (5)
  • packages/compiler-core/__tests__/transforms/__snapshots__/cacheStatic.spec.ts.snap is excluded by !**/*.snap
  • packages/compiler-dom/__tests__/transforms/__snapshots__/stringifyStatic.spec.ts.snap is excluded by !**/*.snap
  • packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap is excluded by !**/*.snap
  • packages/compiler-sfc/__tests__/__snapshots__/templateTransformAssetUrl.spec.ts.snap is excluded by !**/*.snap
  • packages/compiler-sfc/__tests__/__snapshots__/templateTransformSrcset.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • packages/shared/src/patchFlags.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Redirect rules
  • GitHub Check: Header rules
  • GitHub Check: Pages changed
🔇 Additional comments (1)
packages/shared/src/patchFlags.ts (1)

142-142:

✅ Verification successful

Align the CACHED mapping label with the enum identifier

You’ve updated the human-readable name for PatchFlags.CACHED from "HOISTED" to "CACHED", which now correctly reflects the enum. Ensure that any tests, snapshots, or codegen logic (e.g., vue-macros golden files) depending on the old label are updated accordingly.

To verify no stray references to "HOISTED" remain, run:


🏁 Script executed:

#!/bin/bash
# Verify no remaining references to "HOISTED" in the codebase
rg -n '"HOISTED"' .

Length of output: 21


Approved: CACHED mapping label updated

Ripgrep search for "HOISTED" returned no results—there are no remaining references in code, tests, snapshots, or codegen artifacts. All related labels have been updated correctly.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@edison1105
Copy link
Member

/ecosystem-ci run

@vuejs vuejs deleted a comment from edison1105 Jun 5, 2025
@vue-bot
Copy link
Contributor

vue-bot commented Jun 5, 2025

📝 Ran ecosystem CI: Open

suite result latest scheduled
nuxt success success
language-tools success success
pinia success success
radix-vue success success
vite-plugin-vue success success
primevue success success
vant success success
test-utils success success
quasar success success
router success success
vue-i18n success success
vuetify success success
vueuse success success
vue-macros failure success
vitepress success success
vue-simple-compiler success success

@edison1105 edison1105 merged commit 4aa7a4a into vuejs:main Jun 5, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 p1-chore Priority 1: this doesn't change code behavior. ready to merge The PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants