vue-class-store icon indicating copy to clipboard operation
vue-class-store copied to clipboard

Implement direct injection of vue into the constructed instance (Vue 2)

Open thecodewarrior opened this issue 4 years ago • 19 comments

I managed to implement directly injecting Vue into the constructed instance, which fixes #26. I also added unit tests for it, which should improve reliability in the future.

This implements #28, #30, #31, and #33. I'll update this branch as those issues are discussed

thecodewarrior avatar Oct 30 '21 00:10 thecodewarrior

Hi, and thanks for the PR. It looks like you've made some really useful updates!

I'm happy to look through the code, but it would useful if you could outline your changes explicitly in your PR intro; perhaps using the changelog format added, changed, removed, etc?

Also, thanks very much for the tests.

Did you also try your code out with the demos?

  • https://github.com/davestewart/vue-class-store-demos

You can use npm link to try out your version.

Also, there is a Vue 3 branch we will need to update. I suggest holding off that until I've had a chance to look at this, and we can go there too.

Looking forward to continuing the conversation!

Cheers, Dave

davestewart avatar Oct 31 '21 10:10 davestewart

I've updated the PR intro with a function-by-function summary of the changes I made. I hadn't tried the demos before, but I just did and SASS is failing because it doesn't support Apple's M1 architecture. I'll try it later on another computer though.

thecodewarrior avatar Oct 31 '21 19:10 thecodewarrior

Looking at the Vue 3 architecture, I don't think we'll be able to achieve this same kind of behavior with a decorator. If we want to maintain object identity we'll have to do some superclass shenanigans. Vue 3 can't add reactivity to an existing object because it uses proxies. We could, however, return a proxy from the superclass constructor. There would just be more limitations on the class hierarchy (i.e. only interfaces)

thecodewarrior avatar Nov 01 '21 00:11 thecodewarrior

By the way, this feels like a bit of a backwards PR.

You're clearly putting a lot of effort in (thank you!) but I'm having to read code to understand what you're trying to accomplish and attempt to work out why and how.

Also, it seems like you are aiming to change lots of things / add lots of features in a single PR (not ideal, though appreciate the ambition / passion!).

Ideally we would have had:

  • issue (problem)
  • discussion
  • proposal
  • pr (solution)
  • changelog

We're doing:

  • pr (solution)
  • changelog
  • discussion
  • ...

To help me get up to speed, can you update the PR with a bit of intro?

  • Background: what were the problems you were having?
  • Proposal: what do you think needed to change and why?
  • Implementation (done): what is the thrust of your proposal?

Or something along those lines.

Sorry to be a bit pedantic / obtuse, but I'm mega busy at the moment and getting zero time for OSS, so the more you help me, the more likely I am to merge any changes (rather than ignore this for six months until I have the headspace for it!)

In fact - could you start a new issue, and reference this PR? That would be even more useful as I can add labels, reference it from future issues, etc, etc.

Maybe copy the format of this: https://github.com/davestewart/alias-hq/issues/17

Thanks Pierce.

davestewart avatar Nov 02 '21 21:11 davestewart

No problem! I just created several issues covering the various aspects of this PR, which hopefully help clarify what I'm trying to do here.

I don't have much experience with the more formal OSS process, and I got nerdsniped hard by this challenge, so I kinda just dove straight into it. Plus my development style tends to be… haphazard isn't quite the right word, but in the process of fixing one thing other stuff often get swept along for the ride. I get in the mode of "I see problem? I fix problem." and start squashing bugs and fixing deficiencies as I go.

The most opinionated change I made, which I just reverted, was excluding __ data members from reactivity.

thecodewarrior avatar Nov 05 '21 00:11 thecodewarrior

Yay! Thanks 🙏

I had a situation last year with Vuex Pathify where Vue Class Component was added by a contributor. I didn't really get why it was needed in the core, but I went along with it as I was busy at the time, and these were very bright guys making the proposal. Anyway, 2 years later and with the migration it's now causing issues so I'm being more careful now.

There's far less code here, so hopefully I can get round to looking at this sooner rather than later 😃

davestewart avatar Nov 05 '21 12:11 davestewart

Any update on this?

thecodewarrior avatar Jan 07 '22 22:01 thecodewarrior

Hey,

Had planned to get a bunch of OSS done over Christmas, but just ended up taking a very well earned break.

However, I'm taking January out to get a bunch of stuff done, including ticking off all my outstanding OSS tickets.

Obviously it takes a fair bit of cognitive switching effort to jump between projects like this, but I am committed to doing it.

Don't panic, I have not forgotten you!

davestewart avatar Jan 12 '22 14:01 davestewart

Awesome! Glad you had a good break. We've been hosting our build directly off GitHub for the time being (https://github.com/DFStudio/vue-class-store/tree/dfs-dist), so it hasn't been a significant hindrance, but having an official release would of course be better.

thecodewarrior avatar Jan 13 '22 18:01 thecodewarrior

Looking at this again I noticed I didn't remove the __ case from the Vue 2 readme docs and the Vue 3 readme hasn't been updated to explain the need to extend VueStore. Once these get approved on a technical level I'll go in and update/spruce up those.

thecodewarrior avatar Jan 19 '22 02:01 thecodewarrior

Hey @thecodewarrior!

Just to let you know I spent this evening cleaning up a bunch of OSS projects.

This doesn't necessarily mean I'll have the time to work on everything right now, but at least I can see the wood for the trees.

How's things with you? Are you still using Vue Class Store (or your fork of it) in your own projects?

davestewart avatar Apr 26 '23 21:04 davestewart

Things are going well! We're using our fork currently, and haven't had any issues with it.

thecodewarrior avatar Apr 26 '23 21:04 thecodewarrior

Cool! I'd love to find the time to review everything soon. There's some fairly gnarly code in there.

Would a zoom be out of the question if I wanted to get up to speed with things?

davestewart avatar Apr 26 '23 21:04 davestewart

Yeah, I'd be up for a zoom call. I'm west coast and have a fairly open schedule most of the time

thecodewarrior avatar Apr 27 '23 00:04 thecodewarrior

Cool! Not sure how best to organise. Are you OK with calendly links? Some people hate them!

davestewart avatar May 04 '23 08:05 davestewart

Yeah, that works! Also it's been two weeks already!? Time really slips away when writing unholy numbers of unit tests.

I set up a time, but if it doesn't work for you now we can reschedule.

thecodewarrior avatar May 15 '23 19:05 thecodewarrior

It works for me! Looking forward to it 🙏

davestewart avatar May 15 '23 22:05 davestewart

This branch is ready to merge 👍

thecodewarrior avatar May 16 '23 19:05 thecodewarrior

You're a machine!

Will take a look tomorrow and report back

davestewart avatar May 16 '23 22:05 davestewart