Repository: Avaiga/taipy
File: frontend/taipy-gui/src/components/Taipy/Chart.tsx (TypeScript)

Code before:
                                propagate,
                            ),
                        );
                        return;
                    }
                    traces.forEach((tr, idx) => {
                        if (upvars[idx] && tr && tr.length) {
                            dispatch(createSendUpdateAction(upvars[idx], tr, module, props.onChange, propagate));
                        }
                    });
                } else if (config.traces.length === 1) {
                    const upVar = getUpdateVar(updateVars, "selected0");
                    if (upVar) {
                        dispatch(createSendUpdateAction(upVar, [], module, props.onChange, propagate));
                    }
                }
            }
        },
        [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module],
    );

    useEffect(() => {
        if (!dataPl.length || !animationDataValues) return;

        const toFramesData = dataPl.map((trace) => {
            const isYaxisAnimated = Object.prototype.hasOwnProperty.call(animationDataValues, (trace as ScatterData).name);
            const isXaxisAnimated = (trace as ExtendedPlotData).meta?.xAxisName &&
                Object.prototype.hasOwnProperty.call(animationDataValues, (trace as ExtendedPlotData).meta?.xAxisName as PropertyKey);

            return {
                name: (trace as ScatterData).name,
                x: isXaxisAnimated ? animationDataValues[(trace as ExtendedPlotData).meta?.xAxisName as keyof typeof animationDataValues] ?? [] : (trace as ScatterData).x,
                y: isYaxisAnimated ? animationDataValues[(trace as ScatterData).name as keyof typeof animationDataValues] ?? [] : (trace as ScatterData).y,
            };
        });

        setFrames((prevFrames) => ({
            from: prevFrames.to
                ? { ...prevFrames.to, name: "from" }
                : { name: "from", data: [], traces: [], layout: {}, group: "", baseframe: "" },
            to: {
                name: "to",
                data: toFramesData,
                traces: dataPl.map((_, idx) => idx),
                layout: {},
                group: "",
                baseframe: "from",
            },
        }));
    }, [dataPl, animationDataValues]);


Review comment (suggestion):
```suggestion
            const isYaxisAnimated = Object.prototype.hasOwn(animationDataValues, (trace as ScatterData).name);
```
`hasOwn()` is 'safer' than `hasOwnProperty()` and I don't understand why you need the `call()`.

Code after:
                        dispatch(
                            createSendUpdateAction(
                                setVars.values().next().value,
                                traces,
                                module,
                                props.onChange,
                                propagate
                            )
                        );
                        return;
                    }
                    traces.forEach((tr, idx) => {
                        if (upvars[idx] && tr && tr.length) {
                            dispatch(createSendUpdateAction(upvars[idx], tr, module, props.onChange, propagate));
                        }
                    });
                } else if (config.traces.length === 1) {
                    const upVar = getUpdateVar(updateVars, "selected0");
                    if (upVar) {
                        dispatch(createSendUpdateAction(upVar, [], module, props.onChange, propagate));
                    }
                }
            }
        },
        [getRealIndex, dispatch, updateVars, propagate, props.onChange, config.traces.length, module]
    );

    useEffect(() => {
        if (!dataPl.length || !animationData || isDataRefresh(animationData)) {
            return;
        }
        const animationKeys = Object.keys(animationData) as Array<keyof ExtendedPlotData>;

        let found = false;
        const toFramesData = dataPl
            .map((trace) => {
                const traceAnimationKeys = animationKeys.filter(
                    (key) => trace.hasOwnProperty(key) && Array.isArray(trace[key]) && Array.isArray(animationData[key])
                );
                if (!traceAnimationKeys.length) {
                    return undefined;
                }
                return traceAnimationKeys.reduce(
                    (tr, key) => {
                        if (!isEqual(trace[key], animationData[key])) {
                            found = true;
                            tr[key] = animationData[key];
                        }
                        return tr;
                    },
                    { ...trace } as Record<string, unknown>