Skip to content

Commit

Permalink
Fix production bug: keep object.constructor.name
Browse files Browse the repository at this point in the history
  • Loading branch information
Maluen committed Nov 5, 2018
1 parent 3a05ebe commit 59a887c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ export function makePath(parentPath, i) {
}

// classes only used to customize output of react-inspector
// HACK: Object.defineProperty otherwise production minification unsets `object.constructor.name`
export class Resource {}
Object.defineProperty(Resource, "name", { value: "Resource" });
class Virtual {}
Object.defineProperty(Virtual, "name", { value: "Virtual" });
class More {}
Object.defineProperty(More, "name", { value: "More" });
class CustomError {} // not using builtin Error because of More object in `message` and `stack` properties
Object.defineProperty(CustomError, "name", { value: "CustomError" });

// NOTE: data shouldn't be a whole callNode object
// since this function isn't able to parse it
Expand Down

0 comments on commit 59a887c

Please sign in to comment.