Skip to content
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

Adding inspect.custom symbol on RealmObject and Collection on Node #6315

Merged
merged 5 commits into from
Dec 13, 2023

Conversation

kraenhansen
Copy link
Member

@kraenhansen kraenhansen commented Dec 12, 2023

What, How & Why?

I finally got tired of the lack of property values on objects as they're being logged and implemented a custom inspect function for Realm.Object and Realm.Collection.

This is the output of logging first a Realm.Object with a string, list, set and dictionary properties.

Screenshot 2023-12-12 at 21 17 31

This closes #2758.

☑️ ToDos

  • 📝 Changelog entry
  • 📝 Compatibility label is updated or copied from previous entry
  • 📝 Update COMPATIBILITY.md
  • 🚦 Tests
  • 📦 Updated internal package version in consuming package.jsons (if updating internal packages)
  • 📱 Check the React Native/other sample apps work if necessary
  • 💥 Breaking label has been applied or is not necessary

Copy link

coveralls-official bot commented Dec 12, 2023

Coverage Status

coverage: 85.573% (-0.9%) from 86.51%
when pulling 8a3502e on kh/custom-inspect-on-node
into b648560 on main.

Copy link
Contributor

@kneth kneth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a goodie for our node.js users

Copy link
Contributor

@elle-j elle-j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way better DX 👏

Comment on lines 20 to 21
import { Collection, Dictionary, List, RealmObject, RealmSet } from "../../internal";
import { Results } from "realm/binding";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preferable to use imports via "realm" instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed - good catch, this is the wrong Results!

@kraenhansen
Copy link
Member Author

Merging now since the failing tests seem unrelated.

@kraenhansen kraenhansen merged commit bb13179 into main Dec 13, 2023
28 of 33 checks passed
@kraenhansen kraenhansen deleted the kh/custom-inspect-on-node branch December 13, 2023 11:26
bimusiek pushed a commit to bimusiek/realm-js that referenced this pull request Mar 14, 2024
…ealm#6315)

* Adding inspect.custom symbol on RealmObject and Collection on Node

* Adding an entry to the changelog

* Improved it a bit

* The possiblyShort helper is no longer needed

* Updated wrong import
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the output from console.log of objects and collections on Node.js
4 participants