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

Error on adding an item to an empty tab panel #11454

Closed
mconner opened this issue Apr 25, 2022 · 1 comment · Fixed by #11487
Closed

Error on adding an item to an empty tab panel #11454

mconner opened this issue Apr 25, 2022 · 1 comment · Fixed by #11487
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team

Comments

@mconner
Copy link

mconner commented Apr 25, 2022

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
Please demonstrate your case at stackblitz by using the issue template below. Issues without a test case have much less possibility to be reviewd in detail and assisted.

https://stackblitz.com/edit/github-qskzbm-ravg37?file=src%2Fapp%2Fapp.component.ts

Current behavior

When using dynamic tabs, if the backing collection for the the ngFor is initially empty, adding an item to the collection results in an error thrown:

preview-18b9a92777aca.js:2

       ERROR TypeError: Cannot read properties of null (reading 'offsetWidth')
    at Function.DomHandler.getWidth (primeng-dom.mjs:341:24)
    at TabView.updateInkBar (primeng-tabview.mjs:314:70)
    at TabPanel.set (primeng-tabview.mjs:93:26)
    at setInputsForProperty (core.mjs:11362:35)
    at elementPropertyInternal (core.mjs:10396:9)
    at Object.ɵɵproperty (core.mjs:14899:9)
    at AppComponent_p_tabPanel_11_Template (app.component.ts:61:8)
    at executeTemplate (core.mjs:9990:9)
    at refreshView (core.mjs:9856:13)
    at refreshEmbeddedViews (core.mjs:10988:17)

Also, If I try to switch tabs on adding, I also get:
preview-18b9a92777aca.js:2

       ERROR TypeError: Cannot read properties of undefined (reading 'disabled')
    at TabView.open (tabview.ts:305:21)
    at AppComponent.openExistingTab (app.component.ts? [sm]:22:18)
    at eval (app.component.ts? [sm]:27:27)
    at timer (zone.js:3083:47)
    at ZoneDelegate.invokeTask (zone.js:434:35)
    at Object.onInvokeTask (application_ref.ts:493:1)
    at ZoneDelegate.invokeTask (zone.js:433:64)
    at Zone.runTask (zone.js:205:51)
    at ZoneTask.invokeTask (zone.js:516:38)
    at ZoneTask.invoke (zone.js:505:52)

Expected behavior

TabView should handle an initially empty set of tabs

Minimal reproduction of the problem with instructions

See StackBlitz example.

What is the motivation / use case for changing the behavior?

We've got a dashboard viewer, we allow users to tab between them. Depending on user configuration, there may be no dashboard initially, till the user loads it.

Please tell us about your environment:

Windows 10, IntelliJ, npm

  • Angular version: 13.2.6
  • PrimeNG version: 13.3.2
  • Browser: Edge
  • Language: TypeScript 4.5.5

  • Node (for AoT issues): node --version = v16.14.0

@davidediak
Copy link
Contributor

Thank you for this fix.
Waiting for it getting release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants