88use Rappasoft \LaravelLivewireTables \Exceptions \DataTableConfigurationException ;
99use Rappasoft \LaravelLivewireTables \Traits \Configuration \ComponentConfiguration ;
1010use Rappasoft \LaravelLivewireTables \Traits \Helpers \ComponentHelpers ;
11+ use Rappasoft \LaravelLivewireTables \Traits \Core \QueryStrings \HasQueryString ;
1112
1213trait ComponentUtilities
1314{
1415 use ComponentConfiguration,
1516 ComponentHelpers;
17+ use HasQueryString;
1618
1719 public array $ table = [];
1820
@@ -48,6 +50,8 @@ trait ComponentUtilities
4850
4951 protected bool $ useComputedProperties = true ;
5052
53+ protected bool $ hasRunConfigure = false ;
54+
5155 /**
5256 * Set any configuration options
5357 */
@@ -71,16 +75,7 @@ public function mountComponentUtilities(): void
7175 */
7276 public function bootedComponentUtilities (): void
7377 {
74- // Fire Lifecycle Hooks for configuring
75- $ this ->callHook ('configuring ' );
76- $ this ->callTraitHook ('configuring ' );
77-
78- // Call the configure() method
79- $ this ->configure ();
80-
81- // Fire Lifecycle Hooks for configured
82- $ this ->callHook ('configured ' );
83- $ this ->callTraitHook ('configured ' );
78+ $ this ->runCoreConfiguration ();
8479
8580 // Make sure a primary key is set
8681 if (! $ this ->hasPrimaryKey ()) {
@@ -89,6 +84,26 @@ public function bootedComponentUtilities(): void
8984
9085 }
9186
87+ protected function runCoreConfiguration (): void
88+ {
89+ if (!$ this ->hasRunConfigure )
90+ {
91+ // Fire Lifecycle Hooks for configuring
92+ $ this ->callHook ('configuring ' );
93+ $ this ->callTraitHook ('configuring ' );
94+
95+ // Call the configure() method
96+ $ this ->configure ();
97+
98+ // Fire Lifecycle Hooks for configured
99+ $ this ->callHook ('configured ' );
100+ $ this ->callTraitHook ('configured ' );
101+
102+ $ this ->hasRunConfigure = true ;
103+
104+ }
105+ }
106+
92107 /**
93108 * Returns a unique id for the table, used as an alias to identify one table from another session and query string to prevent conflicts
94109 */
0 commit comments