Skip to content

Conversation

@ValeraS
Copy link
Collaborator

@ValeraS ValeraS commented Jul 15, 2024

Closes #1014

@ValeraS ValeraS requested a review from artemmufazalov July 15, 2024 12:50
const schemaLoading = schemaIsFetching && schemaData === undefined;

const keyColumnsIds = schemaData?.PathDescription?.Table?.KeyColumnNames;
const keyColumnsIds = schemaData?.[path]?.PathDescription?.Table?.KeyColumnNames;
Copy link
Member

Choose a reason for hiding this comment

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

Schema tab displays nothing

Screenshot 2024-07-15 at 16 29 38

Comment on lines +64 to +66
serializeQueryArgs: ({queryArgs: {path}}) => {
const parts = path.split('/');
return {path: parts[0] || parts[1]};
Copy link
Member

Choose a reason for hiding this comment

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

How does this serialize works? Data is cached for the tenant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes

Comment on lines +37 to +50
do {
const promise = dispatch(
schemaApi.endpoints.getSchema.initiate({path}, {forceRefetch: true}),
);
const {data, originalArgs} = await promise;
promise.unsubscribe();
// Check if the result from the current request is received. rtk-query may skip the current request and
// return data from a parallel request, due to the same cache key.
if (originalArgs?.path === path) {
schemaData = data?.[path];
break;
}
// eslint-disable-next-line no-constant-condition
} while (true);
Copy link
Member

Choose a reason for hiding this comment

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

Why to do this in do while cycle? await is not enough?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As described in the comment, the "promise" may return result from another request (with another params), so we try to repeat the request in this case.

@ValeraS ValeraS merged commit 7f283a0 into main Jul 16, 2024
@ValeraS ValeraS deleted the issue-1014 branch July 16, 2024 09:44
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.

tree items with many children hang browser

3 participants