fix: preserve perPage setting when AJAX updates post data
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

renderFbPosts no longer unconditionally resets page to 1.
Only resets when dataset size changes (new data loaded).
Preserves user's dropdown selection during auto-load.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-20 09:37:23 +01:00
parent 78c5458386
commit b97338f1af

View File

@ -742,9 +742,10 @@
function renderFbPosts(companyId, posts, nextCursor, append) {
var container = document.getElementById('fbPostsContainer-' + companyId);
// Store posts and reset to page 1
// Store posts; only reset page if new dataset is different size
var prevLen = (window._fbAllPosts[companyId] || []).length;
window._fbAllPosts[companyId] = posts;
window._fbPostsPage[companyId] = 1;
if (posts.length !== prevLen) window._fbPostsPage[companyId] = 1;
if (!window._fbPostsPerPage[companyId]) window._fbPostsPerPage[companyId] = 10;
renderFbPostsPage(companyId);