Skip to content

refactor: vue #283

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

refactor: vue #283

wants to merge 7 commits into from

Conversation

teleskop150750
Copy link

No description provided.

Copy link

changeset-bot bot commented Jul 18, 2025

⚠️ No Changeset found

Latest commit: 9a6b07c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@teleskop150750
Copy link
Author

teleskop150750 commented Jul 18, 2025

It makes sense to reduce the possible props options.

@KyleAMathews
Copy link
Collaborator

Yeah using vue's Auto dependency tracking makes sense to me. @samwillis thoughts?

Copy link

pkg-pr-new bot commented Jul 18, 2025

@tanstack/db-example-react-todo

@tanstack/db

npm i https://pkg.pr.new/@tanstack/db@283

@tanstack/electric-db-collection

npm i https://pkg.pr.new/@tanstack/electric-db-collection@283

@tanstack/query-db-collection

npm i https://pkg.pr.new/@tanstack/query-db-collection@283

@tanstack/react-db

npm i https://pkg.pr.new/@tanstack/react-db@283

@tanstack/trailbase-db-collection

npm i https://pkg.pr.new/@tanstack/trailbase-db-collection@283

@tanstack/vue-db

npm i https://pkg.pr.new/@tanstack/vue-db@283

commit: cb83b7a

@samwillis
Copy link
Collaborator

Absolutely, this was very much a first pass based on the react one. With Vues reactivity model the deps are not needed.

I think it's also worth exploring if there is a better model with Vue where we mutate a reactive state object rather than returning the internal derived state. It should enable more fine grade reactivity.

@KyleAMathews
Copy link
Collaborator

@samwillis would that be a non-breaking change? Given this is a breaking change, I'd like this in sooner than later. Fine-grained reactivity would be great though.

@KyleAMathews
Copy link
Collaborator

@teleskop150750 how are you feeling about this PR? Anything left you want to do?

@targetlucked69
Copy link

why did yall go with getters here instead of refs for return properties? Most of Vue composables/hooks excepts Refs as return properties... while this works it feels really weird

@teleskop150750
Copy link
Author

teleskop150750 commented Jul 22, 2025

@KyleAMathews

Look at this example for different frameworks.

https://github.com/fabian-hiller/formisch/blob/main/frameworks/solid/src/primitives/useFieldArray/useFieldArray.ts

We can also decide which API to use. The downside of the example is that destructuring does not work.
When passed to other hooks later, this again requires wrapping in a function.

@targetlucked69 Vue users often use Ref for returning and passing, but this does not mean that this way is always good.

In this PR I swapped ref, reactive, computed. Using getter helps to apply such changes without changing the API

@teleskop150750
Copy link
Author

teleskop150750 commented Jul 22, 2025

@targetlucked69

Watch lecture 26:00 - 32:00

https://www.youtube.com/live/J0O69dGljx8

@KyleAMathews discussion api getter

1:59:00 I don't remember the exact time now

https://www.youtube.com/live/J0O69dGljx8

@teleskop150750 teleskop150750 changed the title Refactor vue part 2: WIP refactor: vue Jul 23, 2025
@targetlucked69
Copy link

I feel like this is entering premature optimization area

@KyleAMathews
Copy link
Collaborator

@targetlucked69 how so? This isn't a hugely complex integration so it seems like we can anticipate necessary optimizations upfront? What would we need to learn before doing more optimizations?

@teleskop150750
Copy link
Author

I feel like this is entering premature optimization area

Why? this PR does nothing except:

  1. remove deps because Vue doesn't need them
  2. simplify the creation of collection
  3. unify the output format, which can be replaced with return functions if desired

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.

4 participants