Skip to content

Commit

Permalink
Issue 44250: Invalidate QueryInfo caches after change to NameIdSettin…
Browse files Browse the repository at this point in the history
…gs.allowUserSpecifiedNames (#669)

### version 2.90.3
*Released*: 10 November 2021
* Issue 44250: Invalidate QueryInfo caches after change to NameIdSettings.allowUserSpecifiedNames
  • Loading branch information
cnathe committed Nov 10, 2021
1 parent 3b11321 commit f5d4545
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/components/package.json
@@ -1,6 +1,6 @@
{
"name": "@labkey/components",
"version": "2.90.2",
"version": "2.90.3",
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
"main": "dist/components.js",
"module": "dist/components.js",
Expand Down
4 changes: 4 additions & 0 deletions packages/components/releaseNotes/components.md
@@ -1,6 +1,10 @@
# @labkey/components
Components, models, actions, and utility functions for LabKey applications and pages.

### version 2.90.3
*Released*: 10 November 2021
* Issue 44250: Invalidate QueryInfo caches after change to NameIdSettings.allowUserSpecifiedNames

### version 2.90.2
*Released*: 3 November 2021
* Ensure LK instances without LKSM do not call prefix-related actions
Expand Down
Expand Up @@ -8,9 +8,10 @@ import DomainForm from '../DomainForm';
import { getDomainPanelStatus, saveDomain } from '../actions';
import { BaseDomainDesigner, InjectedBaseDomainDesignerProps, withBaseDomainDesigner } from '../BaseDomainDesigner';

import { isSampleManagerEnabled } from '../../../app/utils';

import { DataClassPropertiesPanel } from './DataClassPropertiesPanel';
import { DataClassModel, DataClassModelConfig } from './models';
import { isSampleManagerEnabled } from "../../../app/utils";

interface Props {
nounSingular?: string;
Expand Down Expand Up @@ -45,7 +46,7 @@ class DataClassDesignerImpl extends PureComponent<Props & InjectedBaseDomainDesi
nounSingular: 'Data Class',
nounPlural: 'Data Classes',
domainFormDisplayOptions: { ...DEFAULT_DOMAIN_FORM_DISPLAY_OPTIONS, domainKindDisplayName: 'data class' },
loadNameExpressionOptions: loadNameExpressionOptions,
loadNameExpressionOptions,
};

constructor(props: Props & InjectedBaseDomainDesignerProps) {
Expand Down
Expand Up @@ -19,8 +19,9 @@ import { loadNameExpressionOptions } from '../../settings/actions';

import { PROPERTIES_PANEL_NAMING_PATTERN_WARNING_MSG } from '../constants';

import { isSampleManagerEnabled } from '../../../app/utils';

import { DataClassModel } from './models';
import {isSampleManagerEnabled} from "../../../app/utils";

const PROPERTIES_HEADER_ID = 'dataclass-properties-hdr';
const FORM_IDS = {
Expand Down
Expand Up @@ -42,11 +42,7 @@ import { ENTITY_FORM_IDS } from '../entities/constants';

import { AutoLinkToStudyDropdown } from '../AutoLinkToStudyDropdown';

import {
getCurrentProductName,
isCommunityDistribution,
isSampleManagerEnabled
} from '../../../app/utils';
import { getCurrentProductName, isCommunityDistribution, isSampleManagerEnabled } from '../../../app/utils';

import { loadNameExpressionOptions } from '../../settings/actions';

Expand Down
Expand Up @@ -76,7 +76,7 @@ import { BulkAddData } from '../editable/EditableGrid';

import { DERIVATION_DATA_SCOPE_CHILD_ONLY } from '../domainproperties/constants';

import {getCurrentProductName, isSampleManagerEnabled} from '../../app/utils';
import { getCurrentProductName, isSampleManagerEnabled } from '../../app/utils';

import { fetchDomainDetails } from '../domainproperties/actions';

Expand Down
Expand Up @@ -7,6 +7,8 @@ import { Alert, ConfirmModal, LabelHelpTip, LoadingSpinner, RequiresPermission }

import { sampleManagerIsPrimaryApp } from '../../app/utils';

import { invalidateQueryDetailsCache } from '../../query/api';

import { loadNameExpressionOptions, saveNameExpressionOptions } from './actions';

const TITLE = 'ID/Name Settings';
Expand Down Expand Up @@ -97,6 +99,12 @@ export const NameIdSettingsForm: FC<NameIdSettingsFormProps> = props => {

try {
await saveNameExpressionOptions('allowUserSpecifiedNames', !allowUserSpecifiedNames);

// Issue 44250: the sample type and data class queryInfo details for the name column will set the
// setShownInInsertView based on this allowUserSpecifiedNames setting so we need to invalidate the cache
// so that the updated information is retrieved for that table/query.
invalidateQueryDetailsCache();

setState({
allowUserSpecifiedNames: !allowUserSpecifiedNames,
savingAllowUserSpecifiedNames: false,
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/internal/query/api.ts
Expand Up @@ -30,7 +30,11 @@ import {
ViewInfo,
} from '../..';

const queryDetailsCache: { [key: string]: Promise<QueryInfo> } = {};
let queryDetailsCache: { [key: string]: Promise<QueryInfo> } = {};

export function invalidateQueryDetailsCache(): void {
queryDetailsCache = {};
}

export function invalidateQueryDetailsCacheKey(key: string): void {
delete queryDetailsCache[key];
Expand Down

0 comments on commit f5d4545

Please sign in to comment.