Preserve scroll position when no Nostr connected
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user