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

Cannot read property 'fingerprint' of null, fixed with :key="time()" #2044

Closed
booni3 opened this issue Nov 17, 2020 · 4 comments
Closed

Cannot read property 'fingerprint' of null, fixed with :key="time()" #2044

booni3 opened this issue Nov 17, 2020 · 4 comments

Comments

@booni3
Copy link

booni3 commented Nov 17, 2020

Description

As in the title, this is coming from a nested component when calling "$refresh" after a model has been updated.

Exact steps to reproduce

I am working on a way to reproduce this. My setup is a few nested components that are causing the issue. It may well be that I have another error in the general layout but adding the time() key does fix it, so I think that shows there is maybe scope for making things more durable?

Fix

As in #1686 (comment), adding time() to the component key fixes the issue... but I am unsure why.

Stripped-down, copy-pastable code snippets

Context

  • Livewire version: 2.2
  • Laravel version: 8.3
  • Browser: Chrome
@erikwestlund
Copy link
Contributor

This is a diffing issue. it's often caused when a div is added or removed based upon a condition in your component. Do you have any conditionally displayed HTML in your component? If so, try wrapping it in divs and/or adding wire:keys to those divs.

@booni3
Copy link
Author

booni3 commented Nov 18, 2020

Thanks, Erik.

Yes I am aware of the diffing issues. By standard, I always wrap every @if in a set of DIV's and also try to avoid using @if @else because they cannot be wrapped. I have not tried adding wire:keys to these divs but I do generally add an id="" to them which I found did a similar thing.

Maybe I should try keys...

@RoccoHoward
Copy link

It's a common issue - and lands at the top of https://laravel-livewire.com/docs/2.x/troubleshooting when dealing with any type of dom refresh.

@calebporzio
Copy link
Collaborator

Closing this. Thanks for helping everyone! (I plan on making improvements to morphdom in the future that should hopefully eliminate things like this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants