Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue "Cannot read properties of undefined (reading 'id') at ResizeHandler.attachListener" with current OpenUI5 / SAPUI5 Version #13

Closed
gregorwolf opened this issue Jul 27, 2023 · 3 comments · Fixed by #14
Assignees
Labels
bug Something isn't working

Comments

@gregorwolf
Copy link
Contributor

We use this control in our app that is deployed to the SAP Build Work Zone. It's currently using SAPUI5 Version 1.116.0. There I get this error in the console:

Uncaught TypeError: Cannot read properties of undefined (reading 'id')
    at ResizeHandler.attachListener (ResizeHandler.js?eval:119:19)
    at ResizeHandler.register (ResizeHandler.js?eval:241:25)
    at constructor.onAfterRendering (ScrollEnablement.js:746:46)
    at each (Element.js?eval:349:31)
    at Element._handleEvent (Element.js?eval:362:3)
    at finalizeRendering (RenderManager.js?eval:1262:16)
    at flushInternal (RenderManager.js?eval:1347:4)
    at RenderManager.render (RenderManager.js?eval:1497:4)
    at UIArea.rerender (UIArea.js?eval:651:22)
    at _renderPendingUIUpdates (Rendering.js?eval:100:40)

I've created the branch bug/resize-handler where this issue can be replicated.

@wridgeu
Copy link
Contributor

wridgeu commented Jul 27, 2023

Hey @gregorwolf

interesting! I had a look and dug around a bit. I figured out that the error only occurred in the second use-case, using the fromFile option. That might very well be related to the way it was previously implemented or rather fixed in #5 and the way the render cycles worked or handled the rendering itself.

Previously the control wasn't really "finished", no closing 'div'-tag was added but it still worked. It was due to the way the rendering happened/got triggered and the rerender then took care of it and replaced/overwrote the control accordingly (crude, rough explanation for what I have in my mind right now => basically the 2nd render/rerender/cycle ... would've closed it when adding the content).

Now that doesn't seem to work anymore as it completely crashes when the control isn't properly closed and has issues in finding the parents of the control for resize & focus handling. There is also a warning displayed after your error, saying it cannot determine the DOM location for this custom control:

image

I tested a simple adjustment here fix/resize-handler-bug.

image

image

Take it with a grain of salt though, I'm not that good with words here and definitely don't have a perfect mental model of all that happens in the rendering of UI5, but I try. ^^

Were there other scenarios that didn't work?

BR,
Marco :)

@gregorwolf
Copy link
Contributor Author

Hi @wridgeu,

thank you for the correction. In the browser the error is gone and the markdown file displayed again. I would say get the PR ready.

CU
Gregor

@wridgeu
Copy link
Contributor

wridgeu commented Jul 27, 2023

Oh, awesome. :)

I'll simply use the fix and include your version bumps & everything in the PR (not sure if the .nvmrc is necessary though?) and have Volker give it another look.

BR
Marco

@wridgeu wridgeu added the bug Something isn't working label Jul 27, 2023
@wridgeu wridgeu self-assigned this Jul 27, 2023
@vobu vobu closed this as completed in #14 Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants