Preserve scroll position when no Nostr connected
CI / Lint (pull_request) Successful in 1m34s
CI / Test (pull_request) Successful in 59s

This commit is contained in:
2026-09-03 08:25:03 -06:00
parent 1b60915e3f
commit 9d928217ca
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ export default class ActivityService extends Service {
* @param {string|null} pubkey The user's Nostr pubkey, or null
*/
async load(pubkey) {
if (this.items.length > 0 && pubkey) return;
if (this.items.length > 0) return;
this._userPubkey = pubkey || null;
this._since = Math.floor(Date.now() / 1000) - SINCE_WINDOW;
this.isLoading = true;
+6 -2
View File
@@ -273,13 +273,17 @@ module('Unit | Service | activity', function (hooks) {
assert.strictEqual(service._userPubkey, null);
});
test('load with no pubkey clears items', async function (assert) {
test('load with no pubkey preserves existing items', async function (assert) {
const service = this.owner.lookup('service:activity');
service.items = [{ fake: true }];
await service.load(null);
assert.strictEqual(service.items.length, 0);
assert.strictEqual(
service.items.length,
1,
'items preserved when already loaded'
);
});
test('_resolveSender applies profile when available', function (assert) {