Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8807: Fixed multiplied GraphQL subitems request #1348

Closed

Conversation

barw4
Copy link
Contributor

@barw4 barw4 commented Sep 16, 2024

🎫 Issue IBX-8807

Description:

The issue is caused by the fact that componentDidUpdate runs whilst the loadPage request is still running in componentDidMount.

@@ -184,7 +185,7 @@ export default class SubItemsModule extends Component {

const shouldLoadPage = !activePageItems;

if (shouldLoadPage) {
if (shouldLoadPage && !isLoading) {
Copy link
Contributor

@tischsoic tischsoic Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, for one more comment. :) We further discussed this solution in the frontend team and would like to adjust it slightly. Currently, the solution works without problems because during the request we are blocking in the UI any action related to the request, like: going to another page or changing the sorting order. However, if these were not blocked in the UI, the solution would not work because ongoing older request would prevent newer requests with different data.

Because of this, we think that a better solution might be to check whether the parameters of the request - stored in e.g. queryConfig - have changed in the meantime and if they did then we should proceed with the request.
This is similar to how the useEffect hook works (ref. https://react.dev/reference/react/useEffect#fetching-data-with-effects ) from the newer React approach (which cannot be used in this older component).

Suggested change
if (shouldLoadPage && !isLoading) {
if (shouldLoadPage && !this.haveRequestParamsChanged()) {

@barw4
Copy link
Contributor Author

barw4 commented Oct 2, 2024

Closing in favor of #1355

@barw4 barw4 closed this Oct 2, 2024
@barw4 barw4 deleted the IBX-8807-ibx-8807-fix-multiplied-GraphQL-subitems-request branch October 2, 2024 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants