`oget` fails if the JS object has `:constructor` set to `null`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- tooling
Research direction
Start with is-prototype? in helpers.cljs, at the stack trace location, and reproduce the oget example with a JavaScript object whose constructor is null. Verify that accessing :a no longer throws when the constructor is absent, while normal prototype checks still work.
Written by the indexing model from the issue text.
Description
=> (oget #js {:constructor nil, :a 1} :a)
TypeError: Cannot read properties of null (reading 'prototype')
at Object.oops$helpers$is_prototype_QMARK_ [as is_prototype_QMARK_] (helpers.cljs:7)
at Object.oops$helpers$cljs_type_QMARK_ [as cljs_type_QMARK_] (helpers.cljs:19)
at Object.oops$core$validate_object_access_dynamically [as validate_object_access_dynamically] (core.cljs:39)
at eval (views.cljs:308)
The culprit seems to be this function:
(defn is-prototype? [o]
(identical? (.-prototype (.-constructor o)) o))
Perhaps it should check if (.-constructor o) is not null?
- Dominant language
- Clojure
- Stars
- 350
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from binaryage/cljs-oops
-
oset being strict Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
All issues in binaryage/cljs-oops
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
.Team/Metabot Priority:P3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
needs triage
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
scalar-labs/scalar-jepsen#222 · 1 comment ·