Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

feat: detect and handle adding/removing fiv-gallery-image dynamically #183

Open
@ryaa

Description

@ryaa

Feature Request

Describe the Feature Request
Support adding/removing fiv-gallery-image dynamically in the below use case

          <fiv-gallery #gallery>
            <ion-slides>
              <ion-slide *ngFor="let photoDraft of recipePhotoDrafts">
                <div>
                  <fiv-gallery-image [src]="photoDraft.thumbnailAsBase64"></fiv-gallery-image>
                </div>
              </ion-slide>
            </ion-slides>
          </fiv-gallery>

Right now, new photos/images added are displayed but clicking on them does not open a preview. My assumption is that this is because images QueryList is not subscribed for changes and the fiv-gallery does not take into account if image(s) are added/removed.

Describe Preferred Solution
The dynamically added images must support click to open a preview.

Describe Alternatives

Subscribe to images QueryList changes and handle them accordingly. Right now I have to use showGallery flag and toggle it off and on to accomodate the changes but this makes the component to flicker when it is re-rendered.

          <fiv-gallery #gallery *ngIf="showGallery === true">
            <ion-slides>
              <ion-slide *ngFor="let photoDraft of recipePhotoDrafts">
                <div>
                  <fiv-gallery-image [src]="photoDraft.thumbnailAsBase64"></fiv-gallery-image>
                </div>
              </ion-slide>
            </ion-slides>
          </fiv-gallery>

Related Code
See above

Additional Context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions