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

Issue 44250: Invalidate QueryInfo caches after change to NameIdSettings.allowUserSpecifiedNames #669

Merged
merged 5 commits into from Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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