use fromSync true to indicate pasting from url should refresh the ui (#5195)

This commit is contained in:
James Gatz 2022-09-19 12:52:44 +02:00 committed by GitHub
parent d28d8cafb6
commit b3c3c9b594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -113,7 +113,6 @@ export const RequestPane: FC<Props> = ({
const gitVersion = useGitVCSVersion();
const activeRequestSyncVersion = useActiveRequestSyncVCSVersion();
const activeEnvironment = useSelector(selectActiveEnvironment);
// const activeResponse = useSelector(selectActiveResponse);
const activeRequestMeta = useSelector(selectActiveRequestMeta);
// Force re-render when we switch requests, the environment gets modified, or the (Git|Sync)VCS version changes
const uniqueKey = `${activeEnvironment?.modified}::${request?._id}::${gitVersion}::${activeRequestSyncVersion}::${activeRequestMeta?.activeResponseId}`;

View File

@ -13,9 +13,9 @@ import {
ACTIVITY_UNIT_TEST,
AUTOBIND_CFG,
} from '../../common/constants';
import { database } from '../../common/database';
import { importRaw } from '../../common/import';
import { initializeSpectral, isLintError } from '../../common/spectral';
import * as requestOperations from '../../models/helpers/request-operations';
import * as models from '../../models/index';
import {
isRequest,
@ -147,16 +147,19 @@ export class WrapperClass extends PureComponent<Props, State> {
if (r && r._type === 'request' && activeRequest && isRequest(activeRequest)) {
// Only pull fields that we want to update
return requestOperations.update(activeRequest, {
return database.update({
...activeRequest,
modified: Date.now(),
url: r.url,
method: r.method,
headers: r.headers,
// @ts-expect-error -- TSCONVERSION
body: r.body,
authentication: r.authentication,
// @ts-expect-error -- TSCONVERSION
parameters: r.parameters,
});
},
// Pass true to indicate that this is an import
true
);
}
} catch (error) {
// Import failed, that's alright