Skip to content

Commit

Permalink
Merge pull request #1524 from NicoPennec/fix/entity-list
Browse files Browse the repository at this point in the history
Fix UI refresh when an entity list is paginated
  • Loading branch information
NicoPennec authored Sep 4, 2024
2 parents d56e3f0 + 85191aa commit a534037
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/store/modules/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ const helpers = {
result = sortAssetResult(result, sorting, taskTypeMap, taskMap)
cache.result = result

const displayedAssets = result.slice(0, PAGE_SIZE)
const limit =
state.displayedAssets.length > PAGE_SIZE
? state.displayedAssets.length
: PAGE_SIZE
const displayedAssets = result.slice(0, limit)
const maxX = displayedAssets.length
const maxY = state.nbValidationColumns

Expand Down
6 changes: 5 additions & 1 deletion src/store/modules/edits.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ const helpers = {
result = sortEditResult(result, sorting, taskTypeMap, taskMap)
cache.result = result

const displayedEdits = result.slice(0, PAGE_SIZE)
const limit =
state.displayedEdits.length > PAGE_SIZE
? state.displayedEdits.length
: PAGE_SIZE
const displayedEdits = result.slice(0, limit)
const maxX = displayedEdits.length
const maxY = state.nbValidationColumns

Expand Down
6 changes: 5 additions & 1 deletion src/store/modules/shots.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ const helpers = {
result = sortShotResult(result, sorting, taskTypeMap, taskMap)
cache.result = result

const displayedShots = result.slice(0, PAGE_SIZE)
const limit =
state.displayedShots.length > PAGE_SIZE
? state.displayedShots.length
: PAGE_SIZE
const displayedShots = result.slice(0, limit)
const maxX = displayedShots.length
const maxY = state.nbValidationColumns

Expand Down
6 changes: 4 additions & 2 deletions tests/unit/store/assets.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,8 @@ describe('Assets store', () => {

test('SET_ASSET_SEARCH', () => {
const state = {
assetSorting: { 123: 123 }
assetSorting: { 123: 123 },
displayedAssets: []
}
const payload = {
sorting: 123,
Expand Down Expand Up @@ -1864,7 +1865,8 @@ describe('Assets store', () => {
test('CHANGE_ASSET_SORT', () => {
const state = {
assetSorting: { 123: 123 },
assetSearchText: 'search'
assetSearchText: 'search',
displayedAssets: []
}
const payload = {
sorting: { 123: 124 },
Expand Down

0 comments on commit a534037

Please sign in to comment.