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

Communicate store refresh and item moves across tabs #10905

Merged
merged 2 commits into from
Jan 27, 2025
Merged

Conversation

bhollis
Copy link
Contributor

@bhollis bhollis commented Jan 26, 2025

This is something I've been thinking about for a while - it turned out not to be too hard. For folks who open DIM in multiple tabs, the experience can kind of suck, because each tab is its own independent instance. This means they can each load their own view of the profile, and any item moves are only reflected in the tab they're done in.

This PR uses the Web Locks API and BroadcastChannel to sync up multiple tabs. Now, only one tab will refresh the inventory at any given time. When it's done, it notifies all the other tabs to refresh the cached profile from Bungie.net.

I also made it notify about item moves - you can open two windows side by side, and start moving items in one window, those moves will be replicated in the other tab.

It should be pretty easy to expand this to other actions - lock/unlock, DIM API storage (tagging, loadout updates), clearing the "new item" flag.

@bhollis bhollis merged commit 2a1c182 into master Jan 27, 2025
7 checks passed
@bhollis bhollis deleted the cross-tab branch January 27, 2025 03:08
Copy link

sentry-io bot commented Jan 28, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: Failed to fetch /4611686018430317156/d2/ View Issue

Did you find this useful? React with a 👍 or 👎

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 this pull request may close these issues.

1 participant