Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labkey/components",
"version": "7.60.0",
"version": "7.60.1-fb-issue1470.1",
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
"sideEffects": false,
"files": [
Expand Down
10 changes: 5 additions & 5 deletions packages/components/src/internal/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export function saveGridView(
containerPath,
views: [{ ...ViewInfo.serialize(viewInfo), replace, session, inherit, shared, hidden }],
success: () => {
invalidateQueryDetailsCache(schemaQuery, containerPath);
invalidateQueryDetailsCache(schemaQuery);
resolve();
},
failure: response => {
Expand Down Expand Up @@ -640,7 +640,7 @@ export function saveSessionView(
hidden: false,
replace,
success: () => {
invalidateQueryDetailsCache(schemaQuery, containerPath);
invalidateQueryDetailsCache(schemaQuery);
resolve();
},
failure: response => {
Expand Down Expand Up @@ -720,12 +720,12 @@ export function deleteView(
containerPath,
revert,
success: () => {
invalidateQueryDetailsCache(schemaQuery, containerPath);
invalidateQueryDetailsCache(schemaQuery);
resolve();
},
failure: response => {
if (response.exceptionClass === VIEW_NOT_FOUND_EXCEPTION_CLASS) {
invalidateQueryDetailsCache(schemaQuery, containerPath);
invalidateQueryDetailsCache(schemaQuery);
resolve(); // view has already been deleted
} else {
console.error(response);
Expand Down Expand Up @@ -760,7 +760,7 @@ export function renameGridView(
newName,
},
success: Utils.getCallbackWrapper(response => {
invalidateQueryDetailsCache(schemaQuery, containerPath);
invalidateQueryDetailsCache(schemaQuery);
resolve();
}),
failure: Utils.getCallbackWrapper(error => {
Expand Down
25 changes: 8 additions & 17 deletions packages/components/src/internal/query/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,13 @@ function getQueryDetailsCacheKey(

export function invalidateQueryDetailsCache(
schemaQuery: SchemaQuery,
containerPath?: string,
fk?: string,
fields?: string | string[],
exactKeyMatch = false
): void {
if (exactKeyMatch) {
const key = getQueryDetailsCacheKey(schemaQuery, containerPath, fk, fields);
delete queryDetailsCache[key];
} else {
const prefix = getQueryDetailsCacheKey(schemaQuery);
Object.keys(queryDetailsCache).forEach(cacheKey => {
if (cacheKey.startsWith(prefix)) {
delete queryDetailsCache[cacheKey];
}
});
}
const prefix = getQueryDetailsCacheKey(schemaQuery);
Object.keys(queryDetailsCache).forEach(cacheKey => {
if (cacheKey.toLowerCase().startsWith(prefix.toLowerCase())) {
delete queryDetailsCache[cacheKey];
}
});
}

interface GetQueryDetailsBasic extends Omit<
Expand Down Expand Up @@ -127,7 +118,7 @@ export function getQueryDetails(options: GetQueryDetailsOptions): Promise<QueryI
// where it is unable to resolve the tableInfo. This is deemed a 'success'
// by the request standards but here we reject as an outright failure
if (queryDetails.exception) {
invalidateQueryDetailsCache(schemaQuery, containerPath, fk, fields);
invalidateQueryDetailsCache(schemaQuery);
reject({
schemaQuery,
message: queryDetails.exception,
Expand All @@ -141,7 +132,7 @@ export function getQueryDetails(options: GetQueryDetailsOptions): Promise<QueryI
},
failure: (error, request) => {
console.error(error);
invalidateQueryDetailsCache(schemaQuery, containerPath, fk, fields);
invalidateQueryDetailsCache(schemaQuery);
reject({
message: error.exception,
exceptionClass: error.exceptionClass,
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/public/QueryModel/QueryModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,11 @@ export class QueryModel {
}

get schemaName(): string {
return this.schemaQuery.schemaName;
return (this.queryInfo?.schemaQuery ?? this.schemaQuery).schemaName;
}

get queryName(): string {
return this.schemaQuery.queryName;
return (this.queryInfo?.schemaQuery ?? this.schemaQuery).queryName;
}

get viewName(): string {
Expand Down