-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Implement 2022.3/Stage 3 Decorator Support #3638
Conversation
🦋 Changeset detectedLatest commit: 78bee62 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Matchlighter for picking this up! Looking quite sane so far, left a bunch of questions!
6f41744
to
5ce0269
Compare
Just pushed another patchset. All tests are passing locally (except |
Thanks for the awesome work so far @Matchlighter! The coming two weeks I'm too busy to give this PR the proper attention to wrap it up, push it forward etc, but I think this is strongly heading in the right direction, so feel free to already update docs etc. My plan is to first unblock @urugator on the React 18 work half March (#3590) and then I'll focus on decorators. (I'm feeling quite the bottleneck now😅) |
@mweststrate All good! I'm getting a bit busy too so it works well! I'll go ahead and work on getting things cleaned up and updating docs over then next week or so. |
6de073c
to
0908ca6
Compare
Pushed a new change with updated doc and with local builds/tests completing successfully. It appears there's a regression in the type-checker's module resolution logic in the TypeScript 5.0 Beta and RC, but it's corrected in the nightly, so I bumped the TS resolution up to the most recent (as of writing this) nightly. There's also a (non-critical) TODO regarding eslint - it warns about being incompatible with TS 5, but otherwise works - will need to bump the |
Run yarn --frozen-lockfile --ignore-scripts |
0908ca6
to
50c5de9
Compare
Wuh...? Latest Hrm. Seeing an issue with something about |
@Matchlighter Thank you so much for the PR. Just for you to know, you don't have to squash and force push all the time, cause we merge PRs with "squash" flag enabled. It seems like because of force push GitHub always requires us to approve and run your PR while usually it's enough to approve only once. I'll approve again. |
Ahh, gotcha. 👍 |
2fd5d0f
to
224f162
Compare
@Matchlighter you can bump TS to 5.0.2, it's released now. |
@Amareis I've updated things, but I've discovered what seems to be a bug in TS 5.0.2 that wasn't present in the betas. I've submitted microsoft/TypeScript#53448 that was caught by one of MobX's specs. I've worked around it in the spec for now. |
One question about field actions ( |
@kubk Is that CI error a known issue? It doesn't really seem to be related and I'm unable to repro locally. |
@Matchlighter This test is unfortunately timing sensitive, it waits for GC. Was trying to find some reasonable value for the timeout, but it still occasionally fails depending on CI workload. Feel free to change it to 5000ms or whatever passes. |
@urugator Ah gotcha. I'll try playing with it. I know there's a hook in Node to force a GC - I'll try that and then try timing. Edit: Ah you're already using that. Seems weird that it's not immediate - the project I used it in, it was reliably done by the next run of the event loop. |
If |
@mweststrate Do you have an updated timeline of when you can look at this? |
@Matchlighter sorry, I've been terrible swamped lately. But I expect we can release #3673 in the coming days, then I'll pick this one up first thing. Again apologies for being the bottleneck and the delay in reviewing your awesome work! |
@Matchlighter Sorry, the React work hit more bumps than we hoped. The React work is not entirely wrapped up, but I think the remaining changes are local enough to be able to safely rebase this branch. Are you able to look into that or do you want me to take care of that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, such an awesome job you did here @Matchlighter! I left a bunch of comments, but overall things look really good. I still want to give it a manual test drive, but beyond that I don't think much is in the way of releasing.
I'll send you a maintainers invite as well, that makes it a bit easier to contribute in the future as you can directly write to the repo. Feel free to reject or accept!
Also, again super sorry this is taking so long. You've put a lot of effort in here, it didn't deserve to be on the shelve for so long. Also, note that we can sponsor significant contributions, let me know via DM / mail if you want to make use of that!
"tsdx": "^0.14.1", | ||
"typescript": "^4.0.2" | ||
"typescript": "^5.0.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is little hastle, it could be interesting to split out the tooling & infra updates (Jest and TS) from the actual changes as separate PR, which we can land quickly, given that space wise the largest updates is coming from Jest, it might be nice to have that hitched down before landing decorators, to be able to more easily roll back if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof. That would have been a good thought for me to think of... I'll see what I can do.
}) | ||
}) | ||
|
||
test("verify object assign (2022.3) (legacy/field decorator)", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
false | ||
) | ||
adm.values_.set(name, observable) | ||
initializedObjects.add(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asObservableObject
is idempotent, so I'm not 100% we need the initializedObjects
? This feels a bit irky, but probably that can possibly be optimised later, fine for now I guess. I imagine we could do a check with asObservableObject(target)[$mobx].values_.has
if we still need to init.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works too. This approach mimics how TS handles some of the accessor
stuff in the transpiled code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviving this discussion, it seems this might still change in the spec: tc39/proposal-decorators#513
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm crossing my fingers! That changing would make this so much cleaner (and probably a little faster since we'll avoid the has()
call
Thanks for the review - I'll take a look in the next few hours. Looks like you already rebased 👍 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preliminary approval. Still want to do some manual testing and land the React fixes first.
Also cc @urugator love your thoughts on this if interested :) (if you can't manage no worries!)
addInitializer(function () { | ||
storeAnnotation(this, name, ann) | ||
}) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be great if there was a config option to forbid this or at least warn. seems to me that it will just be confusing when you have a code base and forget the accessor
modifier and it just silently breaks
|
||
## MobX Core decorators {🚀} | ||
|
||
MobX before version 6 encouraged the use of ES.next decorators to mark things as `observable`, `computed` and `action`. While MobX 6 recommends against using these decorators (and instead using [`makeObservable` / `makeAutoObservable`](observable-state.md)), it is still possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit confusing. Are they recommended for use now or not? Maybe this section should be titled "legacy decorators" and the text changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! I'll went to the docs and there is still some more straightening out to do, but we're close!
The whole mobx-react update took a bit longer than planned 😅, but it has been released, so if it is stable for ~week we can continue with this one finally! I noticed it requires some more doc finetuning, I will follow up on that. Otherwise things look complete :) |
Any news on this? I can't wait for the decorator support for MobX ❤️ |
Hey! Yeah it is primarily waiting on me to update documentation further.
But I could make a pre release! It is code complete, but didn't want to
release before the React 18 integration stabilised, which happened.
…On Wed, 11 Oct 2023, 12:16 TomasChmelik, ***@***.***> wrote:
Any news on this? I can't wait for the decorator support for MobX ❤️
—
Reply to this email directly, view it on GitHub
<#3638 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBE4QNDSWW6QIRPWJODX6ZWY7ANCNFSM6AAAAAAVHMVXNA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Let us know if you run into any issues. Most important migration steps
Remaining:
Note: I couldn't push to the original repo, so further changes are tracked in #3790 |
Branch has been merged through #3790, will announce future on Monday! |
Title kind of speaks for itself on this one.
Prior conversation has taken place in a discussion here: #3373 (comment)
Code change checklist
/docs
. For new functionality, at leastAPI.md
should be updatedyarn mobx test:performance
)