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

[BUG] Cannot read properties of null (reading 'start') #2167

Closed
galvin96 opened this issue May 31, 2023 · 5 comments · Fixed by #2473
Closed

[BUG] Cannot read properties of null (reading 'start') #2167

galvin96 opened this issue May 31, 2023 · 5 comments · Fixed by #2473
Labels
bug Something isn't working

Comments

@galvin96
Copy link

galvin96 commented May 31, 2023

1. Read the FAQs 👇

2. Describe the bug

In the motion/packages/framer-motion/src/animation/utils/is-animation-controls.ts file, variable v can be null. So we can't get start of that variable.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/s/dry-sound-hvcyno?file=/src/App.js

4. Steps to reproduce

Steps to reproduce the behavior:

  1. Go to CodeSandBox
  2. Click on 'Click here'
  3. See error

5. Expected behavior

check out the console

@galvin96 galvin96 added the bug Something isn't working label May 31, 2023
@galvin96
Copy link
Author

I fixed that problem, could you give me permission to push my commit?

@tomfinney
Copy link

had this issue pop up for me the other day. there was some naive typing on my part passing down null instead of undefined and, unless i'm missing something, some naive typing in framer letting you pass in null when null isn't expected and breaks

export function isAnimationControls(v?: unknown): v is AnimationControls {
    return typeof v === "object" && typeof (v as any).start === "function"
}

this check should probably look to exclude null like return typeof v === "object" && v !== null && typeof (v as any).start === "function"? but if null is not meant to be allowed at all, maybe some type def should be modified too?

@a-rbsn
Copy link

a-rbsn commented Nov 20, 2023

I've also just encountered this error after updating an older project — the project worked fine before, will update here if I find out why it's happening in my case — I can't find any reference to animation controls in my next js directories.

@galvin96
Copy link
Author

I think it's just a simple problem. We can solve it easily if I have permission to push commit and raise a PR.

@a-rbsn
Copy link

a-rbsn commented Nov 20, 2023

Yes, I was using a seperate library for detecting whether the element was in the viewport and returning a null to animate= if not, had to replace a {} instead to regain the functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants