Skip to content

feat(trees): add Vue adapter#652

Open
onmax wants to merge 1 commit into
pierrecomputer:mainfrom
onmax:codex/add-vue-trees
Open

feat(trees): add Vue adapter#652
onmax wants to merge 1 commit into
pierrecomputer:mainfrom
onmax:codex/add-vue-trees

Conversation

@onmax
Copy link
Copy Markdown

@onmax onmax commented May 7, 2026

Description

Adds first-class Vue 3 support for @pierre/trees through the new @pierre/trees/vue entrypoint. The adapter includes a Vue component, composables for selection and search state, SSR handoff through preloadedData, and a Vue browser fixture.

The Trees docs now include Vue getting started and API pages alongside React and vanilla, plus updates to the integration and SSR guides.

Motivation & Context

Vue users can now adopt Trees without using the React wrapper or dropping down to the vanilla API. The adapter keeps the existing imperative FileTree model as the shared contract, so core renderer behavior stays aligned across integrations.

Planning to add support in Reka UI and Nuxt UI upstream as well :)

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality). You must have
    first discussed with the dev team and they should be aware that this PR is
    being opened
  • Breaking change (fix or feature that would change existing functionality).
    You must have first discussed with the dev team and they should be aware
    that this PR is being opened
  • Documentation update

How was AI used in generating this PR

Codex helped implement the Vue adapter, docs, tests, and review fixes under my direction. Also used codex to create a project inside /tmp and verify everythign works in a brand-new project using @Browser use and tweak things.

Related issues

None.

PS: I know this have a high cost for maintenance, but the other route I can think of is moving this code to Reka UI and support there instead. I am also planning to add a PR to add diffs support. Let me know what works for you. Thanks!

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

@onmax is attempting to deploy a commit to the Pierre Computer Company Team on Vercel.

A member of the Team first needs to authorize it.

@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedvue@​3.5.341001009196100

View full report

@onmax onmax marked this pull request as ready for review May 7, 2026 08:37
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85b356f3c2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +222 to +227
if (this.shouldRenderPreloadedTemplate && this.preloadedData != null) {
children.push(
h('template', {
innerHTML: this.preloadedData.shadowHtml,
shadowrootmode: 'open',
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate declarative shadow template to SSR-only renders

preloadedData currently always pushes a <template shadowrootmode="open"> vnode during client renders, but declarative shadow DOM only attaches when the HTML parser sees that template in server markup. When this node is created via Vue on the client, hasExistingPreloadedContent() can still detect the template and route to hydrate(), even though no parser-created shadow tree exists, which can cause hydration against non-preloaded DOM (or avoidable mismatch/recovery work). The React adapter avoids this by rendering the preload template only when window is undefined, so Vue should apply the same SSR-only guard.

Useful? React with 👍 / 👎.

@onmax onmax mentioned this pull request May 7, 2026
5 tasks
@SlexAxton
Copy link
Copy Markdown
Contributor

I'm curious if you have strong opinions about whether this should go directly in the library? On the one hand, AI can probably write decent vue code, and the wrappers are decently thin, but on the other hand, I know quite little about vue myself, so it's hard for me to evaluate whether I'm making good updates there.

Would this be better served by a 'community adapters' section in the docs and a project that you or someone else like you maintains?

@onmax
Copy link
Copy Markdown
Author

onmax commented May 19, 2026

I totally understand the concern.

I can move this into a separate community-maintained package and maintain it myself, so the Vue-specific maintenance burden does not fall on you

Would that direction work for you?

My current thought is to keep it as a single package with a thin documentation layer, exporting the Vue adapter pieces from one place. Before I go that route, I would appreciate any concerns or recommendations about this direction, or anything else that would make this easier to reference from the Pierre docs as a community adapter.

Happy to adapt the approach based on what would fit best on your side.

@SlexAxton
Copy link
Copy Markdown
Contributor

that works for me. Once it's up I can link it in the official docs as well. We appreciate it!

@SlexAxton
Copy link
Copy Markdown
Contributor

re: advice: I'd just stick as close as you can to a port of the react wrapper component as is reasonable in your framework. The key things to double check are that SSR and ssr + slot hydration work as you expect. (e.g. you can render a context menu that hydrates, or a header that is interactive).

There's also a gotcha with hydration and our use of declarative shadow dom. Essentially declarative shadow dom is such that the dom that is eventually generated is different than the html that's shipped down the wire (without any js changing it, just by nature of DSD). So the hydration boundary needs to hydrate based on the eventual shadow dom situation, rather than the same markup it sent down the wire from the server. Which usually means you'll have to ignore hydration warnings.

happy to answer any other questions or be generally helpful.

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