-
-
Notifications
You must be signed in to change notification settings - Fork 358
[Map] Make UX Map compatible with Live Components (and some internal things) #2385
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
Conversation
📊 Packages dist files size differenceThanks for the PR! Here is the difference in size of the packages dist files between the base branch and the PR.
|
00fc2d4
to
bcbc42a
Compare
Note: Usages and examples can be a bit limited for the moment, but for a next PR I would like to add more methods like |
bcbc42a
to
635bf7c
Compare
/** | ||
* @internal | ||
*/ | ||
#[LiveProp(hydrateWith: 'hydrateMap', dehydrateWith: 'dehydrateMap')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[LiveProp(hydrateWith: 'hydrateMap', dehydrateWith: 'dehydrateMap')] | |
#[LiveProp(hydrateWith: 'hydrateMap', dehydrateWith: 'dehydrateMap')] |
Should be private i think, and we maybe should create a dedicated hydration extension here.. wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it public otherwise the Live hydration process was not working due to visibility issue. Maybe I can try to add a setter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss all this tomorrow :)
074fa84
to
c90ac6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!!
c90ac6d
to
558eb5c
Compare
/** | ||
* @author Hugo Alliaume <hugo@alliau.me> | ||
*/ | ||
trait ComponentWithMapTrait |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* @author Hugo Alliaume <hugo@alliau.me> | |
*/ | |
trait ComponentWithMapTrait | |
/** | |
* @author Hugo Alliaume <hugo@alliau.me> | |
* | |
* @experimental | |
*/ | |
trait ComponentWithMapTrait |
558eb5c
to
6d4ead0
Compare
… methods internal
… of Map's value objects, add MapOptionsNormalizer
Co-authored-by: Simon André <smn.andre@gmail.com>
6d4ead0
to
74d937a
Compare
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Map] Fix default values of Stimulus Map Controller | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Issues | Fix #2417 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> This issue happens at `doCreateMap` when we called `->fitBoundsToMarkers()` instead of `->center(...)`. The value `center` was supposed to be `null`, but since I forgot to configure the default value of `this.centerValue` to `null`, it automatically used `{}` as default value (https://stimulus.hotwired.dev/reference/values#getters) and it breaks the code. This bug has been introduced in #2385. Commits ------- 4cb91ef [Map] Fix default values of Stimulus Map Controller
Here’s a corrected and polished version of your text:
Hi! 😊
This PR enhances the UX Map to be compatible with Live Components, allowing you to interact with the
Map
directly from your PHP code. You can perform actions and see your map update in real-time from the front-end!To achieve this, I had to refactor and improve several areas:
toArray
and newfromArray
methods forMap
,Marker
, and all other value objects could rebuild an equivalent object accurately (e.g.,$marker == Marker::fromArray($marker->toArray())
).view
object containingzoom
,center
,markers
, etc. These properties were split into individual values to improve performance.@id
is now automatically computed for eachMarker
andPolygon
definition. This optimization makes rendering significantly more efficient, avoiding the need to remove and re-render all markers or polygons (and avoiding a visual glitch aswell).Enregistrement.de.l.ecran.2024-11-17.a.10.30.54-2.mov
Enregistrement.de.l.ecran.2024-11-17.a.10.28.15-2.mov