-
Notifications
You must be signed in to change notification settings - Fork 563
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
Singleton useObject #4544
base: main
Are you sure you want to change the base?
Singleton useObject #4544
Conversation
@mfbx9da4 Thanks for submitting this. I'll look it over with the team. Next week I may have some time to add some tests to verify this. |
Awesome, thanks. I have a couple other todos pending including handling deleted objects gracefully. I'll let you know if I get some availability to work on this further. |
Had a little more time to work on it this evening. Again, as yet untested, though I did manage to follow your instructions and run the tests in general. Overall, I think it's shaping up quite nicely though! 🙂 |
Update @takameyer, managed to run the tests and add a test. I've got a few failing ones which I'm a bit confused about since I didn't really modify the way it works. Specifically I'm sure I'll be able to work it out eventually but if you have a moment 🙂 |
Ill have more time to review this next week. Really appreciate the effort here! |
@mfbx9da4 We have been discussing internally how we want to generally handle external PRs. I'll first quote an upcoming update to our contribution guide:
So, let us know your intentions with the PR 🙂. We have this on our backlog, but it will probably take a while before this gets prioritised on our end. If you would like to work on it, it may take some time with the back and forth and a bit of patience, but will in the end be more likely to be accepted into our code base. |
@mfbx9da4 Sorry for the delay. I've added @tomduncalf and @kraenhansen to the PR as well. Let's work together to get this in. |
@@ -84,11 +84,23 @@ describe("useObject hook", () => { | |||
expect(object).toMatchObject(dog2); | |||
}); | |||
|
|||
it("object is null", () => { | |||
it("object is undefined", () => { |
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.
symantically this should be null
if the object doesn't exist
const object2 = result2.current; | ||
|
||
expect(object).toBeDefined(); | ||
expect(object).toEqual(object2); |
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 passes no matter if the reference is different. Change to toBe
Does anyone know why this branch has not been merged ? Thanks |
@TommyTheTribe looks stale to me. I see @takameyer made a few comments which was not addressed and now it also needs a rebase. |
@TommyTheTribe I added tests for the changes made here and they failed. We haven't had the resources available to tackle this ourselves just yet. |
What, How & Why?
To play nicely with React's immutability conventions this PR introduces a singleton object which is returned by useObject.
This closes #4521
☑️ ToDos
...
Compatibility
label is updated or copied from previous entryBreaking
label has been applied or is not necessaryIf this PR adds or changes public API's: