Replies: 1 comment
-
This may be a possible solution: useEffect(() => {
const {
queryLog,
updateQuery,
setQueryOptions,
componentId,
currentPage,
} = listRef?.current?.props;
if (lastRefreshTime && setQueryOptions && queryLog) {
const { query, ...queryOptions } = queryLog;
setQueryOptions(componentId, queryOptions, true);
updateQuery(
{ componentId, query, value: currentPage, URLParams: false },
true
);
}
}, [lastRefreshTime, listRef?.current]); elsewhere: const listRef = useRef();
// lines omitted
<ReactiveList
// other Props unchanged
ref={listRef}
// other Props unchanged
/> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Use case:
ReactiveList
rendered items. Within this modal, users can make changes to an individual result and save.currentPage
to the last page. ButcurrentPage
should only change in this one case.I am currently using something like #1173 and it almost works, but it has a fatal flaw for my application.
If the user is making edits on page 25 out of 75 (we currently have ~750 items in our result set) and they save a change, then updating the dummy refresh query causes the pagination to reset back to page 1 (
from=0
). The user then has to manually page back to 25 to continue where they left off. That's a lot of extra clicks for them and I have a user story to solve this problem.I understand why the behavior exists. In general, if you change search terms it would be expected that you start over from page 1. Consequently, my dummy filter is likely not the best way to accomplish this.
I suspect I need to use a
ref
prop and lift some method/function (fromReactiveList
? orReactiveBase
?) and invoke it myself (while eliminating the dummy filter component entirely) to accomplish what I'm after, but I've been struggling for a few days and thought I would reach out for help rather than continue to spin my wheels.If it helps, I constructed a codesandbox that replicates the issue I'm experiencing with the the dummy filter: https://codesandbox.io/s/compassionate-blackwell-h7g943
To reproduce:
Any help or suggestions would be greatly appreciated. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions