Skip to content

Image on movie detail page does not get updated when switching to another movie #202

Open
@jogelin

Description

@jogelin

Test Case:

chrome-capture-2023-4-26

Cause:

ngSrc does not allow updating the input dynamically. An error is displayed in the console:

caught Error: NG02953: The NgOptimizedImage directive (activated on an <img> element with the `ngSrc="/nsxnMbkl9Lpc12AmYwKi9SmsJ7e.jpg"`) has detected that `ngSrc` was updated after initialization. The NgOptimizedImage directive will not react to this input change. Changing the `ngSrc` would have no effect on the underlying image element, because the resource loading has already occurred. To fix this, either switch `ngSrc` to a static value or wrap the image element in an *ngIf that is gated on the necessary value.
    at postInitInputChangeError (common.mjs:6416:12)
    at common.mjs:6435:19
    at Array.forEach (<anonymous>)
    at assertNoPostInitInputChange (common.mjs:6425:12)
    at NgOptimizedImage.ngOnChanges (common.mjs:6143:13)
    at NgOptimizedImage.rememberChangeHistoryAndInvokeOnChangesHook (core.mjs:2812:14)
    at callHookInternal (core.mjs:3804:14)
    at callHook (core.mjs:3835:9)
    at callHooks (core.mjs:3786:17)
    at executeCheckHooks (core.mjs:3717:5)

Solution:

There is an open issue angular/angular#47813

The alternatives are:

I can make the PR if needed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions