Replies: 4 comments 9 replies
-
I'm not understanding why you're setting that in boot() Your example:
So given that "primaryIdField" will NEVER BE anything other than "id" in your example (as it'll revert to "id" on every lifecycle), just set it to that?
The package follows the conventions for Livewire in so much that there are some checks for query string which depend on configure() being executed. Loading things like static variables in as public will decrease your performance (this applies to ALL Livewire components), and should only be done if you either want to persist something that changes in the backend, or something that is "wired" in the frontend. |
Beta Was this translation helpful? Give feedback.
-
Converted from bug, as is not actually a bug. There are numerous upgrade guides etc that explain the behaviour of lifecycle differences between LIVEWIRE 2, and LIVEWIRE 3. The Tables package was updated to use the Livewire 3 approach, which is why it requires Livewire 3. |
Beta Was this translation helpful? Give feedback.
-
The code I posted here is just an example to illustrate the issue and for the sake of conciseness. My production code is more complex and is not setting the primary ID field - again: this was just for giving a short example. In fact I have a base table class that is extended in many child table classes where I set some properties of the base class. Some of the values for these properties are coming from config files. The properties are then used in the I just wanted to be sure that After some googling I couldn't really find upgrade guides that explain the differences in lifecycle hooks between Livewire v2 and v3 that are related to that issue. If you could point me to some I would be happy to read them. |
Beta Was this translation helpful? Give feedback.
-
This should be fixed in the latest release. Let me know if it isn't please! |
Beta Was this translation helpful? Give feedback.
-
What happened?
I upgraded from version 2.15.0 (on Laravel 10/Livewire 2) to version 3.4.20 (on Laravel 11/Livewire 3). In my table components, I set some properties in the
boot()
method that I want to reuse inconfigure()
.With version 2.15.0, this was no problem. The order of the method calls were:
boot()
(set properties here)configure()
(use properties here)With version 3.4.20, setting properties in
boot()
throws the errorTyped property App\Livewire\Tables\MyTable::$propertyName must not be accessed before initialization
. I checked the order of the method calls and saw that it is now like this:configure()
(should use properties here, but they are not set yet becauseboot()
is not called yet)boot()
configure()
Because
configure()
is called beforeboot()
, it can't use the property that is set inboot()
. Furhtermore,configure()
is called a second time afterboot()
. I suppose the first call toconfigure()
should not be executed.How to reproduce the bug
Here is a code to reproduce the issue:
Package Version
3.4.20
PHP Version
8.2.x
Laravel Version
11.22.0
Alpine Version
3.13.3
Theme
Tailwind 3.x
Notes
No response
Error Message
No response
Beta Was this translation helpful? Give feedback.
All reactions