pyscript icon indicating copy to clipboard operation
pyscript copied to clipboard

py-repl creating duplicate ids

Open tedpatrick opened this issue 3 years ago • 1 comments

Checklist

  • [X] I added a descriptive title
  • [X] I searched for other issues and couldn't find a solution or duplication
  • [X] I already searched in Google and didn't find any good information or help

What happened?

Within generated DOM elements, the py-repl element creates duplicate ids.

Note: my-repl-2 is denoted 2 times Screen Shot 2022-10-18 at 5 51 11 AM

This is causing this test to fail: pytest tests/integration/test_zz_examples.py::TestExamples::test_repl

What browsers are you seeing the problem on? (if applicable)

Firefox, Chrome, Safari, Microsoft Edge

Console info

No response

Additional Context

No response

tedpatrick avatar Oct 18 '22 10:10 tedpatrick

On it :)

marimeireles avatar Oct 18 '22 11:10 marimeireles

@marimeireles note that PR #881 changed the way IDs are generated, now we use py-internal-X, where X is 0, 1, 2, 3, ... https://github.com/pyscript/pyscript/blob/f9194cc833eb938800f1184574e474bca209dd2d/pyscriptjs/src/utils.ts#L41-L45

I think that the bug is still present because I did't change the py-repl logic, but it should make debugging simpler.

Also, I just started another branch to merge base.ts and pyrepl.ts together. So it might make more sense to wait for it to be completed before hunting the bug.

antocuni avatar Oct 24 '22 08:10 antocuni

The bug isn't there. It was in the way we write elements, was hard to find because I didn't introduce it 😅 (and I thought I did) But yeah, let's discuss on the PR :)

marimeireles avatar Oct 24 '22 09:10 marimeireles

This was fixed by Antonio's PR actually, before I landed mine! Fixing a different bug, that also happened to fix this behavior. As an extra step to remove all of these nested ids I have https://github.com/pyscript/pyscript/pull/912 on the way.

marimeireles avatar Oct 31 '22 18:10 marimeireles