Skip to content

Conversation

@gitKrystan
Copy link

Description

I keep running into this error when value is a proxy. With this change, it works even w/ proxies.

TBH I didn't really look at what the point of this code is so IDK if this fix is correct. I just want it to stop borking my debug sessions. 😂

Screenshots

image

I keep running into this when `value` is a proxy
@gitKrystan
Copy link
Author

should maybe guard against null too, IDK. Don't think I've run into null here yet

@patricklx
Copy link
Collaborator

This part of code is used to display object information in inspector object side panel. Basically a subset of key/value pairs gets shown for pure objects
It's shows a subset of object keys for performance.

@patricklx
Copy link
Collaborator

patricklx commented Jul 26, 2025

I do not see any issues with this.
But maybe could add a test?
https://github.com/emberjs/ember-inspector/blob/main/tests/unit/utils/type-check-test.js

@patricklx
Copy link
Collaborator

Should also check when looking at component args

@gitKrystan
Copy link
Author

I don't actually have the repo cloned or the time to write a test ATM but this appears to be the minimal repro:

const foo = new Proxy(
  {},
  {
    get(_target, prop) {
      return null;
    },
  }
);
foo.hasOwnProperty; // null

@patricklx
Copy link
Collaborator

@gitKrystan I do not have access to push something,
add this tests to tests/unit/utils/type-check-test.js

test('inspect | works with proxy', async function (assert) {
    let inspected = new Proxy(
      {},
      {
        get() {
          return null;
        },
      },
    );

    let obj = inspect(inspected);

    assert.deepEqual(obj, '{  }', 'object is in expected shape');
  });

  test('inspect | works with Object.create null proto', async function (assert) {
    let inspected = Object.create(null);

    let obj = inspect(inspected);

    assert.deepEqual(obj, '{  }', 'object is in expected shape');
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants