Skip to content

Pins: Consider external updates and allow ignoring change sources#768

Open
oeninghe-dataport wants to merge 9 commits into
nextfrom
fix/766-pins-consider-external-updates
Open

Pins: Consider external updates and allow ignoring change sources#768
oeninghe-dataport wants to merge 9 commits into
nextfrom
fix/766-pins-consider-external-updates

Conversation

@oeninghe-dataport

Copy link
Copy Markdown
Collaborator

Summary

Consider external updates (#766) and allow ignoring change sources (#655).

Instructions for local reproduction and review

See #766 and #655

Relevant tickets, issues, et cetera

Fixes #766
Fixes #655

As we use the vite plugin enriched console, we do not specify the source
of a log message manually.
This ignores changes originated from addressSearch to the pins
coordinate for the reverseGeocoder in the snowbox.

Fixes #655
@oeninghe-dataport oeninghe-dataport added this to the POLAR@3 milestone Jun 3, 2026
@oeninghe-dataport oeninghe-dataport self-assigned this Jun 3, 2026
@oeninghe-dataport oeninghe-dataport requested a review from a team June 3, 2026 16:34
@oeninghe-dataport oeninghe-dataport added the bug Something isn't working label Jun 3, 2026
@dopenguin

Copy link
Copy Markdown
Member

The target should probably be next and not main, @oeninghe-dataport 😄

@warm-coolguy warm-coolguy changed the base branch from main to next June 22, 2026 09:22
@warm-coolguy

Copy link
Copy Markdown
Member

The target should probably be next and not main, @oeninghe-dataport 😄

Fixed.

sailormoonmeme_6358795

@dopenguin dopenguin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/composables/useStoreWatcher.ts Outdated
)
return
}

watcherConfig.handle = watch(
() => store[watcherConfig.source.key],
watcherConfig.callback,
(value) => {
const sourceKey = watcherConfig.source.key + 'Source'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lacks documentation. Please add information e.g. to the TSDoc of the composable that, if I watch the parameter coordinate I will ignore updates if I have a parameter coordinateSource in my store and have ignoredSources configured.

As this requires a lot of knowledge and extra implementation for each plugin with a possible reference loop, isn't there a possibility of a different approach without the need of further boilerplate in any plugins?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the documentation: dfb50f2

On your question:

I'm also not too happy with the current solution. However, the following aspects convinced me to go with this:

  • The pins plugin seems to be the natural participant in reference loops, even in the future. It allows reading and writing of other plugins in a useful way, which is the case for few plugins; usually, our plugins communicate in one direction only. I don't expect that we will need this in another plugin in the future.
  • I found no approach without further boilerplate (that is not much more "hack-y" than this one). At least this approach allows re-using it in every plugin that refers to pins.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fiddled around a bit with the help of Copilot and came up with a832128. Take a look and let me know if you find any flaws.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I do not think this idea works (yet, or at all). I added a console.log to the if(...) statement in line 138 of useStoreWatcher, and this is not executed. I'd expect that this line is executed in the case of AddressSearch, Pins, ReverseGeocoder: Reference hell #655.
  • I'm not quite sure I understood the code perfectly yet. If we'd want to introduce this, this needs more documentation.
  • If we'd want to introduce this, IMO, we need unit tests here. I know that we decided in general to write tests in a later stage, however, this mechanism is hard to test manually and prone to errors and regressions, and I'd make an exception here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work yet

Oh, it does work.

no_loops

Previously, it would further resolve to Billstraße 144. The loop is broken.

Documentation

There are several TSDoc and normal comments. Can you elaborate on what exactly needs documenting?

Tests

Sure, added two for the loop-breaking-mechanism e6571d9

Comment thread src/plugins/pins/store.ts
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://Dataport.github.io/polar/pr-preview/pr-768/

Built to branch gh-pages at 2026-07-14 20:09 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@oeninghe-dataport

Copy link
Copy Markdown
Collaborator Author

🏓 @dopenguin

@dopenguin

Copy link
Copy Markdown
Member

🏓 @dopenguin

🏓 @oeninghe-dataport

@oeninghe-dataport

Copy link
Copy Markdown
Collaborator Author

🏓 @dopenguin

@dopenguin

Copy link
Copy Markdown
Member

🏓 @dopenguin

@oeninghe-dataport

pingpong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changes to pins coordinate are not reflected in the map AddressSearch, Pins, ReverseGeocoder: Reference hell

3 participants