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

Marker flashed in the wrong position #369

Closed
martesi opened this issue Jul 5, 2024 · 5 comments
Closed

Marker flashed in the wrong position #369

martesi opened this issue Jul 5, 2024 · 5 comments

Comments

@martesi
Copy link
Contributor

martesi commented Jul 5, 2024

Marker and Text are showed by useVisible before their positions are set to the correct ones by useSettingProperties.

In v7.0.2, this causes flashes.

Snipaste_2024-07-05_09-56-25

Snipaste_2024-07-05_09-57-07

@martesi
Copy link
Contributor Author

martesi commented Jul 5, 2024

#370 was assuming problem is caused by the display timing. But the marker is created with same params, it should has the right position in the first place. I can force visible to false on create and set default value for visiable, so useVisiable can display the correct position marker. It's not solving the mystery of the initial wrong position though.

@jaywcjlove
Copy link
Member

@martesi Can rolling back the code fix this issue? I always believed there was nothing wrong with the previous one.

@martesi
Copy link
Contributor Author

martesi commented Jul 5, 2024

You mean v7.0.1? I have pinned the version to v7.0.0 so far. v7.0.1 works fine without strict mode, but I personally like to keep it open, as the reason react recommended it. If that's decided, I can opt out strict mode and provide feedback based on that.

@martesi
Copy link
Contributor Author

martesi commented Jul 11, 2024

This is actually my own fault.

As mentioned earlier, the initial props are passed to Marker constructor on create. In this scenario, Marker should be placed at the right position in the first place.

In this case however, I used a signal that will trigger a effect to update position state. Instead of relying on the position state, I used the signal to control Marker rendering. So the marker is rendered with position undefined then the actual position.

I suppose the old implementation of usePortal might cause the Marker content be rendered later, so the sudden change is not noticed before.

Thank you @jaywcjlove for patient replies and quick responses.

Since the new implementation is now not involved with createRoot, maybe it's safe to say we still support older react versions?

BTW, visiable seems to be a typo. From what I see in the code, react-amap takes visiable as the valid option and modify the visibility on effect. Unless user specify visible at the same time, the related overlays will created as visible by default. Maybe we can mark the typo as deprecated and adjust the behavior accordingly?

@martesi martesi closed this as completed Jul 11, 2024
@jaywcjlove
Copy link
Member

visiable -> visible It's a big job.

jaywcjlove added a commit that referenced this issue Jul 11, 2024
github-actions bot pushed a commit that referenced this issue Jul 11, 2024
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

Successfully merging a pull request may close this issue.

2 participants