reactotron: An object with `writable: false` prop in a state breaks SagaMonitor

We’ve recently added reactotron to our project and it’s pretty cool. We’ve noticed though that it raises an unhandled exception on read-only object’ props in sagas and actions attributes.

In this line https://github.com/infinitered/reactotron/blob/f49760fef66a24bd8ab26dd06c570176f0619c0f/packages/reactotron-core-client/src/scrub.js#L46

object[key] = getFunctionName(value);

an error is raised Cannot assign to read only property 'replace' of object. key === 'replace'.

I’ve noticed that it happens only when an object’s key is read-only.

Object.getOwnPropertyDescriptor(object, key)
// result:
{
  configurable: false,
  enumerable: true,
  value: '',
  writable: false
}

Why do we have a read-only value in an object is a good question and we definitely need to change that, but as a quicker solution we would love to have reactotron not break our app [:

I can add a fork where we run

object[key] = getFunctionName(value);

only when

Object.getOwnPropertyDescriptor(object, key).writable

is true. Will that solve the issue?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (12 by maintainers)

Commits related to this issue

Most upvoted comments

image

Ugh… with a comment like that, I can’t even claim it was an accident either.

@skellock it’s working perfectly now! thanks!

Thx for letting me know.

Reactotron is back at the top of my list of priorities now that I’ve finished gluegun and wrapping up ignite 2.

Keep ya posted.

@skellock I wasn’t gonna say anything about that comment ;D