@plusscommunities/pluss-maintenance-web-feedback 1.1.37-beta.6 → 1.1.37-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +91 -23
- package/dist/index.esm.js +91 -23
- package/dist/index.umd.js +91 -23
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -810,11 +810,25 @@ class JobList extends React.Component {
|
|
|
810
810
|
}
|
|
811
811
|
return params;
|
|
812
812
|
});
|
|
813
|
+
/**
|
|
814
|
+
* Minimum number of items to auto-fill before stopping background fetch.
|
|
815
|
+
* Because DynamoDB pages are unfiltered and the backend filters after
|
|
816
|
+
* query, a single page may yield very few matching results. We keep
|
|
817
|
+
* fetching in the background until we have this many items to display.
|
|
818
|
+
*/
|
|
819
|
+
_defineProperty__default["default"](this, "MIN_PAGE_SIZE", 20);
|
|
813
820
|
/**
|
|
814
821
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
815
822
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
816
|
-
* in-flight fetch checks the counter before
|
|
817
|
-
* if it doesn't match, the results are discarded.
|
|
823
|
+
* in-flight fetch or autoFillPages loop checks the counter before
|
|
824
|
+
* applying results — if it doesn't match, the results are discarded.
|
|
825
|
+
*
|
|
826
|
+
* Alternative: AbortController would actually cancel the HTTP request
|
|
827
|
+
* (axios supports it via the `signal` config option). That would save
|
|
828
|
+
* bandwidth and server load but requires threading `signal` through
|
|
829
|
+
* authedFunction → getJobs2 → fetchPage (3 layers). The fetchId
|
|
830
|
+
* approach is simpler and sufficient — stale requests still complete
|
|
831
|
+
* in the background but their results are ignored.
|
|
818
832
|
*/
|
|
819
833
|
_defineProperty__default["default"](this, "_fetchId", 0);
|
|
820
834
|
/**
|
|
@@ -830,6 +844,9 @@ class JobList extends React.Component {
|
|
|
830
844
|
});
|
|
831
845
|
/**
|
|
832
846
|
* Fetch the first page and render immediately.
|
|
847
|
+
* If fewer than MIN_PAGE_SIZE items returned and there's more data,
|
|
848
|
+
* kicks off a background loop that keeps fetching and appending
|
|
849
|
+
* so results appear progressively.
|
|
833
850
|
*/
|
|
834
851
|
_defineProperty__default["default"](this, "fetchJobs", async () => {
|
|
835
852
|
const fetchId = ++this._fetchId;
|
|
@@ -839,7 +856,8 @@ class JobList extends React.Component {
|
|
|
839
856
|
}, async () => {
|
|
840
857
|
try {
|
|
841
858
|
const res = await this.fetchPage(null);
|
|
842
|
-
if (this._fetchId !== fetchId) return;
|
|
859
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
860
|
+
|
|
843
861
|
const items = res.data.Items || [];
|
|
844
862
|
const lastKey = res.data.LastKey || null;
|
|
845
863
|
this.setState({
|
|
@@ -850,8 +868,13 @@ class JobList extends React.Component {
|
|
|
850
868
|
});
|
|
851
869
|
this.props.jobsLoaded(items);
|
|
852
870
|
this.setRequesters(items);
|
|
871
|
+
|
|
872
|
+
// Auto-fill in background if first page was sparse
|
|
873
|
+
if (lastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
874
|
+
this.autoFillPages(items, lastKey, fetchId);
|
|
875
|
+
}
|
|
853
876
|
} catch (error) {
|
|
854
|
-
if (this._fetchId !== fetchId) return;
|
|
877
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
855
878
|
console.error('fetchJobs', error);
|
|
856
879
|
this.setState({
|
|
857
880
|
loading: false
|
|
@@ -859,8 +882,52 @@ class JobList extends React.Component {
|
|
|
859
882
|
}
|
|
860
883
|
});
|
|
861
884
|
});
|
|
885
|
+
/**
|
|
886
|
+
* Background loop: keep fetching pages and appending results
|
|
887
|
+
* until we have MIN_PAGE_SIZE items or run out of data.
|
|
888
|
+
* Each page is rendered as it arrives so the user sees
|
|
889
|
+
* results appearing progressively.
|
|
890
|
+
*/
|
|
891
|
+
_defineProperty__default["default"](this, "autoFillPages", async (existingJobs, startKey, fetchId) => {
|
|
892
|
+
this.setState({
|
|
893
|
+
loadingMore: true
|
|
894
|
+
});
|
|
895
|
+
let currentJobs = existingJobs;
|
|
896
|
+
let currentLastKey = startKey;
|
|
897
|
+
try {
|
|
898
|
+
while (currentLastKey && currentJobs.length < this.MIN_PAGE_SIZE) {
|
|
899
|
+
const res = await this.fetchPage(currentLastKey);
|
|
900
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
901
|
+
|
|
902
|
+
const items = res.data.Items || [];
|
|
903
|
+
currentLastKey = res.data.LastKey || null;
|
|
904
|
+
currentJobs = [...currentJobs, ...items];
|
|
905
|
+
|
|
906
|
+
// Append to UI immediately after each page arrives
|
|
907
|
+
this.setState({
|
|
908
|
+
jobs: currentJobs,
|
|
909
|
+
lastKey: currentLastKey,
|
|
910
|
+
hasMore: !!currentLastKey
|
|
911
|
+
});
|
|
912
|
+
if (items.length > 0) {
|
|
913
|
+
this.props.jobsLoaded(items);
|
|
914
|
+
this.setRequesters(currentJobs);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
} catch (error) {
|
|
918
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
919
|
+
console.error('autoFillPages', error);
|
|
920
|
+
} finally {
|
|
921
|
+
if (this._fetchId === fetchId) {
|
|
922
|
+
this.setState({
|
|
923
|
+
loadingMore: false
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
});
|
|
862
928
|
/**
|
|
863
929
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
930
|
+
* Fetches one page and also auto-fills in background if sparse.
|
|
864
931
|
*/
|
|
865
932
|
_defineProperty__default["default"](this, "loadMore", async () => {
|
|
866
933
|
const fetchId = ++this._fetchId;
|
|
@@ -873,21 +940,30 @@ class JobList extends React.Component {
|
|
|
873
940
|
}, async () => {
|
|
874
941
|
try {
|
|
875
942
|
const res = await this.fetchPage(lastKey);
|
|
876
|
-
if (this._fetchId !== fetchId) return;
|
|
943
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
944
|
+
|
|
877
945
|
const items = res.data.Items || [];
|
|
878
946
|
const newLastKey = res.data.LastKey || null;
|
|
879
947
|
const updatedJobs = [...jobs, ...items];
|
|
880
948
|
this.setState({
|
|
881
949
|
jobs: updatedJobs,
|
|
882
950
|
lastKey: newLastKey,
|
|
883
|
-
hasMore: !!newLastKey
|
|
884
|
-
loadingMore: false
|
|
951
|
+
hasMore: !!newLastKey
|
|
885
952
|
});
|
|
886
953
|
if (items.length > 0) {
|
|
887
954
|
this.props.jobsLoaded(items);
|
|
888
955
|
}
|
|
956
|
+
|
|
957
|
+
// Auto-fill in background if this page was sparse
|
|
958
|
+
if (newLastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
959
|
+
this.autoFillPages(updatedJobs, newLastKey, fetchId);
|
|
960
|
+
} else {
|
|
961
|
+
this.setState({
|
|
962
|
+
loadingMore: false
|
|
963
|
+
});
|
|
964
|
+
}
|
|
889
965
|
} catch (error) {
|
|
890
|
-
if (this._fetchId !== fetchId) return;
|
|
966
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
891
967
|
console.error('loadMore', error);
|
|
892
968
|
this.setState({
|
|
893
969
|
loadingMore: false
|
|
@@ -1268,7 +1344,7 @@ class JobList extends React.Component {
|
|
|
1268
1344
|
// Filters (applied to server-side queries)
|
|
1269
1345
|
selectedTypeFilter: null,
|
|
1270
1346
|
selectedPriorityFilter: null,
|
|
1271
|
-
selectedStatusFilter:
|
|
1347
|
+
selectedStatusFilter: STATUS_IMCOMPLETE,
|
|
1272
1348
|
selectedTimeFilterStart: null,
|
|
1273
1349
|
selectedTimeFilterEnd: null,
|
|
1274
1350
|
selectedTimeFilterText: null,
|
|
@@ -1719,24 +1795,16 @@ class JobList extends React.Component {
|
|
|
1719
1795
|
}, "Loading more results\u2026"));
|
|
1720
1796
|
}
|
|
1721
1797
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1798
|
+
className: "flex flex-center-row",
|
|
1722
1799
|
style: {
|
|
1723
|
-
|
|
1724
|
-
position: 'relative',
|
|
1725
|
-
top: -16
|
|
1800
|
+
padding: '16px 0'
|
|
1726
1801
|
}
|
|
1727
1802
|
}, /*#__PURE__*/React__default["default"].createElement(Components$7.Button, {
|
|
1728
|
-
|
|
1803
|
+
inline: true,
|
|
1804
|
+
buttonType: "tertiary",
|
|
1729
1805
|
onClick: this.loadMore,
|
|
1730
|
-
isActive: true
|
|
1731
|
-
|
|
1732
|
-
width: '100%'
|
|
1733
|
-
}
|
|
1734
|
-
}, "Load More Results", /*#__PURE__*/React__default["default"].createElement(FontAwesome__default["default"], {
|
|
1735
|
-
name: "plus",
|
|
1736
|
-
style: {
|
|
1737
|
-
marginLeft: 8
|
|
1738
|
-
}
|
|
1739
|
-
})));
|
|
1806
|
+
isActive: true
|
|
1807
|
+
}, "Load More"));
|
|
1740
1808
|
}
|
|
1741
1809
|
renderContent() {
|
|
1742
1810
|
const {
|
package/dist/index.esm.js
CHANGED
|
@@ -779,11 +779,25 @@ class JobList extends Component {
|
|
|
779
779
|
}
|
|
780
780
|
return params;
|
|
781
781
|
});
|
|
782
|
+
/**
|
|
783
|
+
* Minimum number of items to auto-fill before stopping background fetch.
|
|
784
|
+
* Because DynamoDB pages are unfiltered and the backend filters after
|
|
785
|
+
* query, a single page may yield very few matching results. We keep
|
|
786
|
+
* fetching in the background until we have this many items to display.
|
|
787
|
+
*/
|
|
788
|
+
_defineProperty(this, "MIN_PAGE_SIZE", 20);
|
|
782
789
|
/**
|
|
783
790
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
784
791
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
785
|
-
* in-flight fetch checks the counter before
|
|
786
|
-
* if it doesn't match, the results are discarded.
|
|
792
|
+
* in-flight fetch or autoFillPages loop checks the counter before
|
|
793
|
+
* applying results — if it doesn't match, the results are discarded.
|
|
794
|
+
*
|
|
795
|
+
* Alternative: AbortController would actually cancel the HTTP request
|
|
796
|
+
* (axios supports it via the `signal` config option). That would save
|
|
797
|
+
* bandwidth and server load but requires threading `signal` through
|
|
798
|
+
* authedFunction → getJobs2 → fetchPage (3 layers). The fetchId
|
|
799
|
+
* approach is simpler and sufficient — stale requests still complete
|
|
800
|
+
* in the background but their results are ignored.
|
|
787
801
|
*/
|
|
788
802
|
_defineProperty(this, "_fetchId", 0);
|
|
789
803
|
/**
|
|
@@ -799,6 +813,9 @@ class JobList extends Component {
|
|
|
799
813
|
});
|
|
800
814
|
/**
|
|
801
815
|
* Fetch the first page and render immediately.
|
|
816
|
+
* If fewer than MIN_PAGE_SIZE items returned and there's more data,
|
|
817
|
+
* kicks off a background loop that keeps fetching and appending
|
|
818
|
+
* so results appear progressively.
|
|
802
819
|
*/
|
|
803
820
|
_defineProperty(this, "fetchJobs", async () => {
|
|
804
821
|
const fetchId = ++this._fetchId;
|
|
@@ -808,7 +825,8 @@ class JobList extends Component {
|
|
|
808
825
|
}, async () => {
|
|
809
826
|
try {
|
|
810
827
|
const res = await this.fetchPage(null);
|
|
811
|
-
if (this._fetchId !== fetchId) return;
|
|
828
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
829
|
+
|
|
812
830
|
const items = res.data.Items || [];
|
|
813
831
|
const lastKey = res.data.LastKey || null;
|
|
814
832
|
this.setState({
|
|
@@ -819,8 +837,13 @@ class JobList extends Component {
|
|
|
819
837
|
});
|
|
820
838
|
this.props.jobsLoaded(items);
|
|
821
839
|
this.setRequesters(items);
|
|
840
|
+
|
|
841
|
+
// Auto-fill in background if first page was sparse
|
|
842
|
+
if (lastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
843
|
+
this.autoFillPages(items, lastKey, fetchId);
|
|
844
|
+
}
|
|
822
845
|
} catch (error) {
|
|
823
|
-
if (this._fetchId !== fetchId) return;
|
|
846
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
824
847
|
console.error('fetchJobs', error);
|
|
825
848
|
this.setState({
|
|
826
849
|
loading: false
|
|
@@ -828,8 +851,52 @@ class JobList extends Component {
|
|
|
828
851
|
}
|
|
829
852
|
});
|
|
830
853
|
});
|
|
854
|
+
/**
|
|
855
|
+
* Background loop: keep fetching pages and appending results
|
|
856
|
+
* until we have MIN_PAGE_SIZE items or run out of data.
|
|
857
|
+
* Each page is rendered as it arrives so the user sees
|
|
858
|
+
* results appearing progressively.
|
|
859
|
+
*/
|
|
860
|
+
_defineProperty(this, "autoFillPages", async (existingJobs, startKey, fetchId) => {
|
|
861
|
+
this.setState({
|
|
862
|
+
loadingMore: true
|
|
863
|
+
});
|
|
864
|
+
let currentJobs = existingJobs;
|
|
865
|
+
let currentLastKey = startKey;
|
|
866
|
+
try {
|
|
867
|
+
while (currentLastKey && currentJobs.length < this.MIN_PAGE_SIZE) {
|
|
868
|
+
const res = await this.fetchPage(currentLastKey);
|
|
869
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
870
|
+
|
|
871
|
+
const items = res.data.Items || [];
|
|
872
|
+
currentLastKey = res.data.LastKey || null;
|
|
873
|
+
currentJobs = [...currentJobs, ...items];
|
|
874
|
+
|
|
875
|
+
// Append to UI immediately after each page arrives
|
|
876
|
+
this.setState({
|
|
877
|
+
jobs: currentJobs,
|
|
878
|
+
lastKey: currentLastKey,
|
|
879
|
+
hasMore: !!currentLastKey
|
|
880
|
+
});
|
|
881
|
+
if (items.length > 0) {
|
|
882
|
+
this.props.jobsLoaded(items);
|
|
883
|
+
this.setRequesters(currentJobs);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
} catch (error) {
|
|
887
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
888
|
+
console.error('autoFillPages', error);
|
|
889
|
+
} finally {
|
|
890
|
+
if (this._fetchId === fetchId) {
|
|
891
|
+
this.setState({
|
|
892
|
+
loadingMore: false
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
});
|
|
831
897
|
/**
|
|
832
898
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
899
|
+
* Fetches one page and also auto-fills in background if sparse.
|
|
833
900
|
*/
|
|
834
901
|
_defineProperty(this, "loadMore", async () => {
|
|
835
902
|
const fetchId = ++this._fetchId;
|
|
@@ -842,21 +909,30 @@ class JobList extends Component {
|
|
|
842
909
|
}, async () => {
|
|
843
910
|
try {
|
|
844
911
|
const res = await this.fetchPage(lastKey);
|
|
845
|
-
if (this._fetchId !== fetchId) return;
|
|
912
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
913
|
+
|
|
846
914
|
const items = res.data.Items || [];
|
|
847
915
|
const newLastKey = res.data.LastKey || null;
|
|
848
916
|
const updatedJobs = [...jobs, ...items];
|
|
849
917
|
this.setState({
|
|
850
918
|
jobs: updatedJobs,
|
|
851
919
|
lastKey: newLastKey,
|
|
852
|
-
hasMore: !!newLastKey
|
|
853
|
-
loadingMore: false
|
|
920
|
+
hasMore: !!newLastKey
|
|
854
921
|
});
|
|
855
922
|
if (items.length > 0) {
|
|
856
923
|
this.props.jobsLoaded(items);
|
|
857
924
|
}
|
|
925
|
+
|
|
926
|
+
// Auto-fill in background if this page was sparse
|
|
927
|
+
if (newLastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
928
|
+
this.autoFillPages(updatedJobs, newLastKey, fetchId);
|
|
929
|
+
} else {
|
|
930
|
+
this.setState({
|
|
931
|
+
loadingMore: false
|
|
932
|
+
});
|
|
933
|
+
}
|
|
858
934
|
} catch (error) {
|
|
859
|
-
if (this._fetchId !== fetchId) return;
|
|
935
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
860
936
|
console.error('loadMore', error);
|
|
861
937
|
this.setState({
|
|
862
938
|
loadingMore: false
|
|
@@ -1237,7 +1313,7 @@ class JobList extends Component {
|
|
|
1237
1313
|
// Filters (applied to server-side queries)
|
|
1238
1314
|
selectedTypeFilter: null,
|
|
1239
1315
|
selectedPriorityFilter: null,
|
|
1240
|
-
selectedStatusFilter:
|
|
1316
|
+
selectedStatusFilter: STATUS_IMCOMPLETE,
|
|
1241
1317
|
selectedTimeFilterStart: null,
|
|
1242
1318
|
selectedTimeFilterEnd: null,
|
|
1243
1319
|
selectedTimeFilterText: null,
|
|
@@ -1688,24 +1764,16 @@ class JobList extends Component {
|
|
|
1688
1764
|
}, "Loading more results\u2026"));
|
|
1689
1765
|
}
|
|
1690
1766
|
return /*#__PURE__*/React.createElement("div", {
|
|
1767
|
+
className: "flex flex-center-row",
|
|
1691
1768
|
style: {
|
|
1692
|
-
|
|
1693
|
-
position: 'relative',
|
|
1694
|
-
top: -16
|
|
1769
|
+
padding: '16px 0'
|
|
1695
1770
|
}
|
|
1696
1771
|
}, /*#__PURE__*/React.createElement(Components$7.Button, {
|
|
1697
|
-
|
|
1772
|
+
inline: true,
|
|
1773
|
+
buttonType: "tertiary",
|
|
1698
1774
|
onClick: this.loadMore,
|
|
1699
|
-
isActive: true
|
|
1700
|
-
|
|
1701
|
-
width: '100%'
|
|
1702
|
-
}
|
|
1703
|
-
}, "Load More Results", /*#__PURE__*/React.createElement(FontAwesome, {
|
|
1704
|
-
name: "plus",
|
|
1705
|
-
style: {
|
|
1706
|
-
marginLeft: 8
|
|
1707
|
-
}
|
|
1708
|
-
})));
|
|
1775
|
+
isActive: true
|
|
1776
|
+
}, "Load More"));
|
|
1709
1777
|
}
|
|
1710
1778
|
renderContent() {
|
|
1711
1779
|
const {
|
package/dist/index.umd.js
CHANGED
|
@@ -799,11 +799,25 @@
|
|
|
799
799
|
}
|
|
800
800
|
return params;
|
|
801
801
|
});
|
|
802
|
+
/**
|
|
803
|
+
* Minimum number of items to auto-fill before stopping background fetch.
|
|
804
|
+
* Because DynamoDB pages are unfiltered and the backend filters after
|
|
805
|
+
* query, a single page may yield very few matching results. We keep
|
|
806
|
+
* fetching in the background until we have this many items to display.
|
|
807
|
+
*/
|
|
808
|
+
_defineProperty__default["default"](this, "MIN_PAGE_SIZE", 20);
|
|
802
809
|
/**
|
|
803
810
|
* Monotonically increasing ID used to ignore stale fetch results.
|
|
804
811
|
* When a filter changes, fetchJobs() increments this counter. Any
|
|
805
|
-
* in-flight fetch checks the counter before
|
|
806
|
-
* if it doesn't match, the results are discarded.
|
|
812
|
+
* in-flight fetch or autoFillPages loop checks the counter before
|
|
813
|
+
* applying results — if it doesn't match, the results are discarded.
|
|
814
|
+
*
|
|
815
|
+
* Alternative: AbortController would actually cancel the HTTP request
|
|
816
|
+
* (axios supports it via the `signal` config option). That would save
|
|
817
|
+
* bandwidth and server load but requires threading `signal` through
|
|
818
|
+
* authedFunction → getJobs2 → fetchPage (3 layers). The fetchId
|
|
819
|
+
* approach is simpler and sufficient — stale requests still complete
|
|
820
|
+
* in the background but their results are ignored.
|
|
807
821
|
*/
|
|
808
822
|
_defineProperty__default["default"](this, "_fetchId", 0);
|
|
809
823
|
/**
|
|
@@ -819,6 +833,9 @@
|
|
|
819
833
|
});
|
|
820
834
|
/**
|
|
821
835
|
* Fetch the first page and render immediately.
|
|
836
|
+
* If fewer than MIN_PAGE_SIZE items returned and there's more data,
|
|
837
|
+
* kicks off a background loop that keeps fetching and appending
|
|
838
|
+
* so results appear progressively.
|
|
822
839
|
*/
|
|
823
840
|
_defineProperty__default["default"](this, "fetchJobs", async () => {
|
|
824
841
|
const fetchId = ++this._fetchId;
|
|
@@ -828,7 +845,8 @@
|
|
|
828
845
|
}, async () => {
|
|
829
846
|
try {
|
|
830
847
|
const res = await this.fetchPage(null);
|
|
831
|
-
if (this._fetchId !== fetchId) return;
|
|
848
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
849
|
+
|
|
832
850
|
const items = res.data.Items || [];
|
|
833
851
|
const lastKey = res.data.LastKey || null;
|
|
834
852
|
this.setState({
|
|
@@ -839,8 +857,13 @@
|
|
|
839
857
|
});
|
|
840
858
|
this.props.jobsLoaded(items);
|
|
841
859
|
this.setRequesters(items);
|
|
860
|
+
|
|
861
|
+
// Auto-fill in background if first page was sparse
|
|
862
|
+
if (lastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
863
|
+
this.autoFillPages(items, lastKey, fetchId);
|
|
864
|
+
}
|
|
842
865
|
} catch (error) {
|
|
843
|
-
if (this._fetchId !== fetchId) return;
|
|
866
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
844
867
|
console.error('fetchJobs', error);
|
|
845
868
|
this.setState({
|
|
846
869
|
loading: false
|
|
@@ -848,8 +871,52 @@
|
|
|
848
871
|
}
|
|
849
872
|
});
|
|
850
873
|
});
|
|
874
|
+
/**
|
|
875
|
+
* Background loop: keep fetching pages and appending results
|
|
876
|
+
* until we have MIN_PAGE_SIZE items or run out of data.
|
|
877
|
+
* Each page is rendered as it arrives so the user sees
|
|
878
|
+
* results appearing progressively.
|
|
879
|
+
*/
|
|
880
|
+
_defineProperty__default["default"](this, "autoFillPages", async (existingJobs, startKey, fetchId) => {
|
|
881
|
+
this.setState({
|
|
882
|
+
loadingMore: true
|
|
883
|
+
});
|
|
884
|
+
let currentJobs = existingJobs;
|
|
885
|
+
let currentLastKey = startKey;
|
|
886
|
+
try {
|
|
887
|
+
while (currentLastKey && currentJobs.length < this.MIN_PAGE_SIZE) {
|
|
888
|
+
const res = await this.fetchPage(currentLastKey);
|
|
889
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
890
|
+
|
|
891
|
+
const items = res.data.Items || [];
|
|
892
|
+
currentLastKey = res.data.LastKey || null;
|
|
893
|
+
currentJobs = [...currentJobs, ...items];
|
|
894
|
+
|
|
895
|
+
// Append to UI immediately after each page arrives
|
|
896
|
+
this.setState({
|
|
897
|
+
jobs: currentJobs,
|
|
898
|
+
lastKey: currentLastKey,
|
|
899
|
+
hasMore: !!currentLastKey
|
|
900
|
+
});
|
|
901
|
+
if (items.length > 0) {
|
|
902
|
+
this.props.jobsLoaded(items);
|
|
903
|
+
this.setRequesters(currentJobs);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
} catch (error) {
|
|
907
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
908
|
+
console.error('autoFillPages', error);
|
|
909
|
+
} finally {
|
|
910
|
+
if (this._fetchId === fetchId) {
|
|
911
|
+
this.setState({
|
|
912
|
+
loadingMore: false
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
});
|
|
851
917
|
/**
|
|
852
918
|
* Load the next batch of jobs when the user clicks "Load More".
|
|
919
|
+
* Fetches one page and also auto-fills in background if sparse.
|
|
853
920
|
*/
|
|
854
921
|
_defineProperty__default["default"](this, "loadMore", async () => {
|
|
855
922
|
const fetchId = ++this._fetchId;
|
|
@@ -862,21 +929,30 @@
|
|
|
862
929
|
}, async () => {
|
|
863
930
|
try {
|
|
864
931
|
const res = await this.fetchPage(lastKey);
|
|
865
|
-
if (this._fetchId !== fetchId) return;
|
|
932
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
933
|
+
|
|
866
934
|
const items = res.data.Items || [];
|
|
867
935
|
const newLastKey = res.data.LastKey || null;
|
|
868
936
|
const updatedJobs = [...jobs, ...items];
|
|
869
937
|
this.setState({
|
|
870
938
|
jobs: updatedJobs,
|
|
871
939
|
lastKey: newLastKey,
|
|
872
|
-
hasMore: !!newLastKey
|
|
873
|
-
loadingMore: false
|
|
940
|
+
hasMore: !!newLastKey
|
|
874
941
|
});
|
|
875
942
|
if (items.length > 0) {
|
|
876
943
|
this.props.jobsLoaded(items);
|
|
877
944
|
}
|
|
945
|
+
|
|
946
|
+
// Auto-fill in background if this page was sparse
|
|
947
|
+
if (newLastKey && items.length < this.MIN_PAGE_SIZE) {
|
|
948
|
+
this.autoFillPages(updatedJobs, newLastKey, fetchId);
|
|
949
|
+
} else {
|
|
950
|
+
this.setState({
|
|
951
|
+
loadingMore: false
|
|
952
|
+
});
|
|
953
|
+
}
|
|
878
954
|
} catch (error) {
|
|
879
|
-
if (this._fetchId !== fetchId) return;
|
|
955
|
+
if (this._fetchId !== fetchId) return; // stale fetch
|
|
880
956
|
console.error('loadMore', error);
|
|
881
957
|
this.setState({
|
|
882
958
|
loadingMore: false
|
|
@@ -1257,7 +1333,7 @@
|
|
|
1257
1333
|
// Filters (applied to server-side queries)
|
|
1258
1334
|
selectedTypeFilter: null,
|
|
1259
1335
|
selectedPriorityFilter: null,
|
|
1260
|
-
selectedStatusFilter:
|
|
1336
|
+
selectedStatusFilter: STATUS_IMCOMPLETE,
|
|
1261
1337
|
selectedTimeFilterStart: null,
|
|
1262
1338
|
selectedTimeFilterEnd: null,
|
|
1263
1339
|
selectedTimeFilterText: null,
|
|
@@ -1708,24 +1784,16 @@
|
|
|
1708
1784
|
}, "Loading more results\u2026"));
|
|
1709
1785
|
}
|
|
1710
1786
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1787
|
+
className: "flex flex-center-row",
|
|
1711
1788
|
style: {
|
|
1712
|
-
|
|
1713
|
-
position: 'relative',
|
|
1714
|
-
top: -16
|
|
1789
|
+
padding: '16px 0'
|
|
1715
1790
|
}
|
|
1716
1791
|
}, /*#__PURE__*/React__default["default"].createElement(Components$7.Button, {
|
|
1717
|
-
|
|
1792
|
+
inline: true,
|
|
1793
|
+
buttonType: "tertiary",
|
|
1718
1794
|
onClick: this.loadMore,
|
|
1719
|
-
isActive: true
|
|
1720
|
-
|
|
1721
|
-
width: '100%'
|
|
1722
|
-
}
|
|
1723
|
-
}, "Load More Results", /*#__PURE__*/React__default["default"].createElement(FontAwesome__default["default"], {
|
|
1724
|
-
name: "plus",
|
|
1725
|
-
style: {
|
|
1726
|
-
marginLeft: 8
|
|
1727
|
-
}
|
|
1728
|
-
})));
|
|
1795
|
+
isActive: true
|
|
1796
|
+
}, "Load More"));
|
|
1729
1797
|
}
|
|
1730
1798
|
renderContent() {
|
|
1731
1799
|
const {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-maintenance-web-feedback",
|
|
3
|
-
"version": "1.1.37-beta.
|
|
3
|
+
"version": "1.1.37-beta.7",
|
|
4
4
|
"description": "Extension package to enable maintenance on Pluss Communities Platform",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|