Skip to content

Integration between Vue reactivity and Tracker reactivity #3

Closed
@mitar

Description

@mitar

I am looking a bit how you are integrating Tracker with Vue and maybe I am misunderstanding something, it does not yet work as one would expect from perfect integration, because Vue reactivity is not really integrated with Tracker reactivity, no? So you cannot really use inside methods both Tracker reactive functions and access data and expect things to rerun, no?

Luckily, it seems that Vue reactivity has a similar model to Tracker reactivity. It also seems that Vue's state tracking is just a mixin.

Here are some random ideas what we could do:

  • for Meteor Vue components (or it could be an optional mixin), we could make it so that when Vue augments data with getters, we make them also Tracker getters (so when you set it, you invalidate both Vue and Tracker dependencies)
  • we could monkey-patch Vue Dep to make it interact with Tracker.Dependency, APIs are really similar
  • but we probably do not care really that changes which happen inside Tracker dependencies are run on Tracker queue, we probably only want to provide the same API to reactive Meteor code so that it thinks it is running inside autorun, but it fact it is interacting with Vue Dep (and we leave to Vue to run it inside its own queue); this means that inside Vue, we could maybe misuse Tracker.active to set it to a fake computation which interacts with current Vue Dep
  • for Minimongo integration, I wanted for a long time to make something there which would make it so that it is not needed to specify fields on the query to limit reactivity, but it would be limited automatically by the fact that you would use some values and not others, it seems that this could be very well integrated with Vue
  • we should see how Vue wraps mutation objects on arrays and make it so that Minimongo changes trigger those mutations on Vue

What are your thoughts what is missing here for proper Meteor integration?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions