Skip to content

Commit d894632

Browse files
committed
Use url instead of queryMapping in LiveProp constructor
1 parent d0409ca commit d894632

File tree

5 files changed

+14
-23
lines changed

5 files changed

+14
-23
lines changed

src/Autocomplete/assets/dist/controller.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,12 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1515
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1616
PERFORMANCE OF THIS SOFTWARE.
1717
***************************************************************************** */
18-
/* global Reflect, Promise, SuppressedError, Symbol */
19-
2018

2119
function __classPrivateFieldGet(receiver, state, kind, f) {
2220
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
2321
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
2422
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
25-
}
26-
27-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
28-
var e = new Error(message);
29-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
30-
};
23+
}
3124

3225
var _default_1_instances, _default_1_getCommonConfig, _default_1_createAutocomplete, _default_1_createAutocompleteWithHtmlContents, _default_1_createAutocompleteWithRemoteData, _default_1_stripTags, _default_1_mergeObjects, _default_1_createTomSelect;
3326
class default_1 extends Controller {

src/LiveComponent/assets/dist/live_controller.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,6 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof win
592592
let insertionPoint = oldParent.firstChild;
593593
let newChild;
594594

595-
newParent.children;
596-
oldParent.children;
597-
598595
// run through all the new content
599596
while (nextNewChild) {
600597

src/LiveComponent/src/Attribute/LiveProp.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ final class LiveProp
6363
*
6464
* Tells if this property should be bound to the URL
6565
*/
66-
private bool $queryMapping;
66+
private bool $url;
6767

6868
/**
6969
* @param bool|array $writable If true, this property can be changed by the frontend.
@@ -80,7 +80,7 @@ final class LiveProp
8080
* from the value used when originally rendering
8181
* this child, the value in the child will be updated
8282
* to match the new value and the child will be re-rendered
83-
* @param bool $queryMapping if true, this property will be synchronized with a query parameter
83+
* @param bool $url if true, this property will be synchronized with a query parameter
8484
* in the URL
8585
*/
8686
public function __construct(
@@ -93,7 +93,7 @@ public function __construct(
9393
string $format = null,
9494
bool $updateFromParent = false,
9595
string|array $onUpdated = null,
96-
bool $queryMapping = false,
96+
bool $url = false,
9797
) {
9898
$this->writable = $writable;
9999
$this->hydrateWith = $hydrateWith;
@@ -104,7 +104,7 @@ public function __construct(
104104
$this->format = $format;
105105
$this->acceptUpdatesFromParent = $updateFromParent;
106106
$this->onUpdated = $onUpdated;
107-
$this->queryMapping = $queryMapping;
107+
$this->url = $url;
108108

109109
if ($this->useSerializerForHydration && ($this->hydrateWith || $this->dehydrateWith)) {
110110
throw new \InvalidArgumentException('Cannot use useSerializerForHydration with hydrateWith or dehydrateWith.');
@@ -200,8 +200,8 @@ public function onUpdated(): null|string|array
200200
return $this->onUpdated;
201201
}
202202

203-
public function queryMapping(): bool
203+
public function url(): bool
204204
{
205-
return $this->queryMapping;
205+
return $this->url;
206206
}
207207
}

src/LiveComponent/src/Metadata/LiveComponentMetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function createLivePropMetadata(string $className, string $propertyName,
110110
$isTypeBuiltIn,
111111
$isTypeNullable,
112112
$collectionValueType,
113-
$liveProp->queryMapping()
113+
$liveProp->url()
114114
);
115115
}
116116

src/LiveComponent/tests/Fixtures/Component/ComponentWithUrlBoundProps.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,22 @@
2020
class ComponentWithUrlBoundProps
2121
{
2222
use DefaultActionTrait;
23-
#[LiveProp(queryMapping: true)]
23+
24+
#[LiveProp(url: true)]
2425
public ?string $prop1 = null;
2526

26-
#[LiveProp(queryMapping: true)]
27+
#[LiveProp(url: true)]
2728
public ?int $prop2 = null;
2829

29-
#[LiveProp(queryMapping: true)]
30+
#[LiveProp(url: true)]
3031
public array $prop3 = [];
3132

3233
#[LiveProp]
3334
public ?string $prop4 = null;
3435

35-
#[LiveProp(queryMapping: true)]
36+
#[LiveProp(url: true)]
3637
public ?Address $prop5 = null;
3738

38-
#[LiveProp(fieldName: 'field6', queryMapping: true)]
39+
#[LiveProp(fieldName: 'field6', url: true)]
3940
public ?string $prop6 = null;
4041
}

0 commit comments

Comments
 (0)