fix: use protocol 0.6.2 and remove chat scroll backports

This commit is contained in:
coyotte508 2026-09-28 19:51:14 +02:00
commit 2f0c4a0503
5 changed files with 9 additions and 57 deletions

View file

@ -1,42 +0,0 @@
diff --git a/dist/chat-viewport.js b/dist/chat-viewport.js
index 84fdef2bdf411584349a54362663a379d6778808..e322c2a25c0456ada442bbbff2d49494d0db952b 100644
--- a/dist/chat-viewport.js
+++ b/dist/chat-viewport.js
@@ -74,6 +74,11 @@ export function bindChatViewport(list, options) {
chat.markRead(latest.dataset.messageId);
}
}
+ function updateFollowing() {
+ if (list.clientHeight && initialized && list.scrollTop !== programmedScroll) {
+ following = list.scrollHeight - list.scrollTop - list.clientHeight <= 1;
+ }
+ }
function refresh() {
if (disposed || frame !== undefined) {
return;
@@ -81,11 +86,13 @@ export function bindChatViewport(list, options) {
frame = win.requestAnimationFrame(() => {
frame = undefined;
if (list.clientHeight && chat.snapshot.open && (options.isVisible?.() ?? true)) {
+ // Observers can run before the scroll event from a small wheel or touch movement.
+ updateFollowing();
if (scrollToUnread) {
const row = rows().find((element) => chat.snapshot.unreadIds.includes(element.dataset.messageId ?? ""));
if (row) {
list.scrollTop += row.getBoundingClientRect().top - list.getBoundingClientRect().top;
- following = list.scrollHeight - list.scrollTop - list.clientHeight < 32;
+ following = list.scrollHeight - list.scrollTop - list.clientHeight <= 1;
}
else {
following = true;
@@ -103,9 +110,7 @@ export function bindChatViewport(list, options) {
});
}
function scroll() {
- if (list.clientHeight && initialized && list.scrollTop !== programmedScroll) {
- following = list.scrollHeight - list.scrollTop - list.clientHeight < 32;
- }
+ updateFollowing();
refresh();
}
const resize = new ResizeObserver(refresh);

View file

@ -1 +0,0 @@
The protocol 0.6.1 patch backports the [shared chat scrolling fix](https://codeberg.org/boardgamers/boardgamers/commit/7b4e1ff6). It prevents slow wheel and touch gestures from snapping back to the newest message. Remove the patch when upgrading to a protocol release containing that fix.

14
pnpm-lock.yaml generated
View file

@ -6,9 +6,6 @@ settings:
packageExtensionsChecksum: sha256-00qAjbZKW5ZUQ9vzlY/TpeXMvkYJise4VKJxePABdVI=
patchedDependencies:
'@boardgamers/protocol@0.6.1': 4ec4a210cf846eebd6d902b2952c029dbcde5ed288f88dba1f9362a8a9caa953
importers:
.:
devDependencies:
@ -89,8 +86,8 @@ importers:
viewer:
dependencies:
'@boardgamers/protocol':
specifier: 0.6.1
version: 0.6.1(patch_hash=4ec4a210cf846eebd6d902b2952c029dbcde5ed288f88dba1f9362a8a9caa953)
specifier: 0.6.2
version: 0.6.2
container-engine:
specifier: workspace:../engine
version: link:../engine
@ -1045,10 +1042,10 @@ packages:
}
engines: { node: '>=6.9.0' }
'@boardgamers/protocol@0.6.1':
'@boardgamers/protocol@0.6.2':
resolution:
{
integrity: sha512-/SdqqYrRUNizjGqQygR4kxTZqCOqWfj190Uj/YHI8i0pD4eNXGofZJd2QhkB63n0iSRHMvJJRJReadof151wBg==,
integrity: sha512-6FKgLsB4guCzNww1rkanhrsLHIdQVajDs1B4qNsYcgtUobTBRM2VPt9T4mlc8ZDX4JDQltvJVHuK7XDZ1J556A==,
}
'@cspotcode/source-map-support@0.8.1':
@ -7773,6 +7770,7 @@ packages:
{
integrity: sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q==,
}
deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
path-exists@3.0.0:
resolution:
@ -11589,7 +11587,7 @@ snapshots:
'@babel/helper-string-parser': 7.29.7
'@babel/helper-validator-identifier': 7.29.7
'@boardgamers/protocol@0.6.1(patch_hash=4ec4a210cf846eebd6d902b2952c029dbcde5ed288f88dba1f9362a8a9caa953)':
'@boardgamers/protocol@0.6.2':
dependencies:
zod: 4.6.2

View file

@ -18,7 +18,7 @@ allowBuilds:
autoInstallPeers: false
minimumReleaseAgeExclude:
- '@boardgamers/protocol@0.2.2 || 0.3.0 || 0.3.1 || 0.3.3 || 0.4.0 || 0.4.2 || 0.5.0 || 0.6.0 || 0.6.1'
- '@boardgamers/protocol@0.2.2 || 0.3.0 || 0.3.1 || 0.3.3 || 0.4.0 || 0.4.2 || 0.5.0 || 0.6.0 || 0.6.1 || 0.6.2'
# The cli-plugin-typescript fork-ts-checker shim does a bare
# require('@vue/compiler-sfc') expecting the vue-3 parse shape ({descriptor}).
@ -29,6 +29,3 @@ packageExtensions:
'@vue/cli-plugin-typescript':
dependencies:
'@vue/compiler-sfc': ^3.5.41
patchedDependencies:
'@boardgamers/protocol@0.6.1': patches/@boardgamers__protocol@0.6.1.patch

View file

@ -1,6 +1,6 @@
{
"name": "container-viewer",
"version": "2.0.12",
"version": "2.0.13",
"repository": {
"type": "git",
"url": "git+https://github.com/boardgamers/container.git",
@ -19,7 +19,7 @@
"preview:tutorial": "node scripts/tutorial-preview.mjs"
},
"dependencies": {
"@boardgamers/protocol": "0.6.1",
"@boardgamers/protocol": "0.6.2",
"container-engine": "workspace:../engine",
"core-js": "^3.6.5",
"lodash": "^4.17.19",