Skip to content

Commit

Permalink
Update the logic to be more specific
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Jan 4, 2024
1 parent ebd3293 commit 73d811e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion functions/internals/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,10 @@ interface saveLastActiveViewArgs {
user_id: string;
callback_id: string;
is_active_view_refresher?: boolean;
activeView?: SavedAttributes<AV>;
}
export async function saveLastActiveView(
{ av, view_id, user_id, callback_id, is_active_view_refresher }:
{ av, view_id, user_id, callback_id, is_active_view_refresher, activeView }:
saveLastActiveViewArgs,
) {
const last_updated_at = Math.floor(new Date().getTime() / 1000);
Expand All @@ -524,6 +525,11 @@ export async function saveLastActiveView(
};
if (is_active_view_refresher === undefined || !is_active_view_refresher) {
attributes = { ...attributes, last_accessed_at: last_updated_at };
} else if (activeView) {
attributes = {
...attributes,
last_accessed_at: activeView.last_accessed_at,
};
}
await av.save({ attributes });
}
Expand Down
1 change: 1 addition & 0 deletions functions/refresh_main_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ async function updateActiveView({
callback_id: result.view!.callback_id!,
view_id: result.view!.id!,
user_id: user,
activeView,
is_active_view_refresher: true,
});
} catch (e) {
Expand Down

0 comments on commit 73d811e

Please sign in to comment.