Skip to content

I manually fixed 2 errors, here what i done, and what i found to help you patch the errors correctly. #298

@RsMan-Dev

Description

@RsMan-Dev

I am working in solidjs, and many elements are manipulated, so for the following errors, i cannot get easily the original cause, if you cannot reproduce my bugs, i can help you to search.

Sometimes, scroll timeline tries to get progress when clientHeight and scrollHeight are same value, so when the progress is calculated, we get a 0/0, that give us Infinity, Infinity - Infinity gives NaN, and NaN goes up to your setNativeCurrentTime function, where details.animation.currentTime gets NaN - 0.001, an error is thrown.

I patched it in your compiled code temporally using:

    // patches : <v>.animation.currentTime = <a> + <t>
    // to : <v>.animation.currentTime = (<a> + <t>) || 0
    // will avoid NaN to pass, and will set 0 if the result is NaN
    scrollTimelinePolyfill = scrollTimelinePolyfill.replace(
      /(?<vName>[^.]+)\.animation\.currentTime\s*=\s*(?<aName>[^\s+]+)\s*\+\s*(?<tName>[^\s}]+)/,
      (...match) => {
        const {vName, aName, tName} = match.at(-1)
        return `${vName}.animation.currentTime = (${aName} + ${tName}) || 0`
      }
    )

Sometimes measureSource can get an undefined value as source, when updateMeasurements is called from ViewTimeline's constructor's ResizeObservers, details.source is undefined, probably due to DOM change from my app that made this error, but don't know what edit made it as the framework i'm using is handling the DOM updates itself.

I patched it in your compiled code temporally using:

    // patches a : new ResizeObserver(() => {<f>(<v>.source)}).[...]
    // to : new ResizeObserver(() => {<v>.source && <f>(<v>.source)}).[...]
    // will avoid error when <v>.source is undefined, we are ignoring the error
    scrollTimelinePolyfill = scrollTimelinePolyfill.replace(
      /new\s*ResizeObserver\(\s*\(?\s*\(\s*\)\s*=>\s*{\s*(?<fName>[^(]*)\(\s*(?<vName>[^(]*)\.source\s*\)\s*}\s*\)?\s*\)\s*\./,
      (...match) => {
        const {fName, vName} = match.at(-1)
        return `new ResizeObserver((() => {${vName}.source && ${fName}(${vName}.source)})).`
      }
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions