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

Galleria: GalleriaItem activeItem has stale reference when value array is changed. #11882

Closed
key10 opened this issue Aug 30, 2022 · 0 comments · Fixed by #11883
Closed

Galleria: GalleriaItem activeItem has stale reference when value array is changed. #11882

key10 opened this issue Aug 30, 2022 · 0 comments · Fixed by #11883
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@key10
Copy link
Contributor

key10 commented Aug 30, 2022

Describe the bug

GalleriaItem activeItem has a stale reference when value array is changed.

The activeItem reference is setup whenever the activeIndex is set. This causes an issue whenever the value array is updated, without changing the activeIndex, as the activeItem is still referencing the previous object.

Environment

Standard PrimeNG and Angular application

Reproducer

No response

Angular version

13.3.9

PrimeNG version

13.4.1

Build / Runtime

TypeScript

Language

TypeScript

Node version (for AoT issues node --version)

16.14.2

Browser(s)

No response

Steps to reproduce the behavior

  1. Load an array of objects into the value input of a Galleria component, for instance, the example in the showcase documentation.
  2. Programatically change/update the value array, for example, reversing the order of the image objects.
  3. Notice that the current/active GalleriaItem does not update with the new image src.
  4. Upon inspection, the GalleriaItem.activeItem will be referencing the initial value object

Expected behavior

When the value array is updated, the full component tree should update accordingly to the new object sources, without needing to manually change the activeIndex

@key10 key10 added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Aug 30, 2022
@cetincakiroglu cetincakiroglu added this to the 14.0.3 milestone Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants