title: Is there a way keep pages in sync when a query result changes while using Spring Data with pagination
body: <p>I have a page that displays notifications to a user. These notification are retrieved using Spring Data pages. That the query to grab pages has the condition that the notification status must be NEW or OLD. </p>
  
  <p>The issue arises from the fact that users can "dismiss" a notification which makes a call to the server and sets the status as "DIS" which no longer matches this query:</p>
  
  <pre><code>@PreAuthorize("principal.username.equalsIgnoreCase(#employeeLogin)")
  @Query ("select accountServicing "
          + "from AccountServicing accountServicing "             
          + "where UPPER(accountServicing.employeeLogin) = UPPER(:employeeLogin) "
          + "and (UPPER(accountServicing.serviceRequestStatus) = 'NEW' or UPPER(accountServicing.serviceRequestStatus) = 'OLD') "
          + "ORDER BY accountServicing.serviceRequestDate, "
          +"accountServicing.serviceRequestKey")
  public Page&lt;AccountServicing&gt; getAccountActivityServicingBasedOnEmployeeLogin(@Param("employeeLogin") String employeeLogin,Pageable page);
  </code></pre>
  
  <p>Because this "dismissed" record no longer matches, when the user requests the next page records are skipped. It goes like this:</p>
  
  <ol>
  <li>Request Page 0, size 50 -> return records 1-50 </li>
  <li>User Dismisses record 10 -> this record no longer matches the query 
   <em>If I were to request Page 0 again there would now be 1 record that was not previously on Page 0 (previously it was record 51 but now is record 50 due to
  record 10 being excluded from the query)</em></li>
  <li>User requests Page 1, size 50 -> return records 51-100.</li>
  </ol>
  
  <p>As you can see that record 50 that used to be 51 before 1 record was dismissed, gets skipped due to the query results changing mid-paging.</p>
  
  <p>A simple solution would be to simply reload all pages currently loaded on the screen to re-sync, but I want to avoid doing a full reload. Also, since this may help understand, the UI uses an infinite scroll loading approach, so each page requested is simply appended to the displayed results as the user scrolls down.</p>