Skip to content

Sync reset#1280

Merged
tabascq merged 11 commits intoPuzzleServer:mainfrom
morganbr:syncReset
Mar 10, 2026
Merged

Sync reset#1280
tabascq merged 11 commits intoPuzzleServer:mainfrom
morganbr:syncReset

Conversation

@morganbr
Copy link
Copy Markdown
Contributor

@morganbr morganbr commented Sep 9, 2025

This is the server side of syncing resets. It also requires changes in puzzleSync.js. Fixes #1245

@morganbr morganbr requested review from Copilot and tabascq September 9, 2025 03:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements server-side support for syncing puzzle resets between clients. The changes enable the system to handle reset events by creating special reset entries in the database and ensuring proper synchronization of reset state across connected clients.

  • Adds support for puzzle reset synchronization with new reset entry types
  • Implements filtering logic to prevent stale data from appearing after resets
  • Updates JavaScript communication to handle reset events between client and server

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
PuzzleItemProperty.cs Adds IsReset property and CreateReset factory method for reset entries
ClientSyncComponent.razor.cs Implements reset handling logic and filters stale data during sync
ClientSyncComponent.razor Adds JavaScript functions for reset event communication
JsPuzzleChange.cs Defines JsPuzzleReset class for reset data transfer

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread ClientSyncComponent/ClientSyncComponent.Client/Pages/ClientSyncComponent.razor.cs Outdated
Comment thread ClientSyncComponent/ClientSyncComponent.Client/Pages/ClientSyncComponent.razor.cs Outdated
Comment thread ClientSyncComponent/ClientSyncComponent.Client/Pages/ClientSyncComponent.razor.cs Outdated
Comment thread ClientSyncComponent/ClientSyncComponent.Client/Pages/ClientSyncComponent.razor.cs Outdated
Comment thread ClientSyncComponent/ClientSyncComponent.Client/Pages/ClientSyncComponent.razor.cs Outdated
Comment thread ClientSyncComponent/ClientSyncComponent.Client/Pages/ClientSyncComponent.razor.cs Outdated
// If this is a reset, we need to send a reset message to the JS side
await JSRuntime.InvokeVoidAsync("onPuzzleResetSynced", new JsPuzzleReset()
{
puzzleIds = new[] { Encoding.UTF8.GetString(Base64UrlTextEncoder.Decode(entry.SubPuzzleId)) },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not build a list of IDs and send them all at once

@morganbr morganbr requested a review from asyasky March 3, 2026 04:46
@tabascq
Copy link
Copy Markdown
Contributor

tabascq commented Mar 3, 2026

I'm a bit confused - I got mail about these commits this evening, but the PR above says they were added 2 months ago. Which is accurate?

@tabascq
Copy link
Copy Markdown
Contributor

tabascq commented Mar 3, 2026

Now it shows 2 commits instead of 3 and says the commits were added 2 hours ago instead of 2 months ago. I swear this isn't what I saw just a few minutes ago - now I have a new set of questions lol...

Comment thread ClientSyncComponent/ClientSyncComponent.Client/Pages/ClientSyncComponent.razor.cs Outdated
Comment thread ClientSyncComponent/ClientSyncComponent.Client/Pages/ClientSyncComponent.razor.cs Outdated
@tabascq tabascq merged commit 37e8363 into PuzzleServer:main Mar 10, 2026
1 check passed
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.

Sync reset button

3 participants