Skip to content

Commit

Permalink
Allow to create record set from express search results
Browse files Browse the repository at this point in the history
Fixes #3316
  • Loading branch information
maxpatiiuk authored and CarolineDenis committed Apr 10, 2023
1 parent 6afad80 commit 5e93f97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions specifyweb/frontend/js_src/lib/components/Molecules/AppTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ import { mainText } from '../../localization/main';
import { userPreferences } from '../Preferences/userPreferences';
import { UnloadProtectsContext } from '../Router/Router';

export function AppTitle({ title }: { readonly title: LocalizedString }): null {
export function AppTitle({
title,
source = 'form',
}: {
readonly title: LocalizedString;
readonly source?: 'form' | undefined;
}): null {
const [updateTitle] = userPreferences.use(
'form',
'behavior',
'updatePageTitle'
);
useTitle(updateTitle ? title : undefined);
useTitle(source !== 'form' && updateTitle ? title : undefined);
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { LocalizedString } from 'typesafe-i18n';

import type { IR, RA, WritableArray } from '../../utils/types';
import { ErrorBoundary } from '../Errors/ErrorBoundary';
import { useTitle } from '../Molecules/AppTitle';
import { AppTitle } from '../Molecules/AppTitle';
import { LoadingScreen } from '../Molecules/Dialog';

/**
Expand Down Expand Up @@ -95,10 +95,11 @@ export function Async({
readonly Element: React.FunctionComponent;
readonly title: LocalizedString | undefined;
}): JSX.Element {
useTitle(title);

return (
<React.Suspense fallback={<LoadingScreen />}>
{typeof title === 'string' && (
<AppTitle title={title} source={undefined} />
)}
<Element />
</React.Suspense>
);
Expand Down

0 comments on commit 5e93f97

Please sign in to comment.