mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Only force refresh header editor when changing body type (Closes #931)
This commit is contained in:
parent
0705efa55e
commit
5ac53aa3b1
@ -60,6 +60,7 @@ type Props = {
|
||||
isVariableUncovered: boolean,
|
||||
environmentId: string,
|
||||
forceRefreshCounter: number,
|
||||
headerEditorKey: string,
|
||||
|
||||
// Optional
|
||||
request: ?Request,
|
||||
@ -165,6 +166,7 @@ class RequestPane extends React.PureComponent<Props> {
|
||||
updateSettingsShowPasswords,
|
||||
updateRequestMethod,
|
||||
updateRequestUrl,
|
||||
headerEditorKey,
|
||||
} = this.props;
|
||||
|
||||
const paneClasses = 'request-pane theme--pane pane';
|
||||
@ -387,6 +389,7 @@ class RequestPane extends React.PureComponent<Props> {
|
||||
<TabPanel className="react-tabs__tab-panel header-editor">
|
||||
<ErrorBoundary key={uniqueKey} errorClassName="font-error pad text-center">
|
||||
<RequestHeadersEditor
|
||||
key={headerEditorKey}
|
||||
handleRender={handleRender}
|
||||
handleGetRenderContext={handleGetRenderContext}
|
||||
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
|
||||
|
@ -128,6 +128,7 @@ type Props = {
|
||||
activeEnvironment: Environment | null,
|
||||
activeWorkspaceClientCertificates: Array<ClientCertificate>,
|
||||
isVariableUncovered: boolean,
|
||||
headerEditorKey: string,
|
||||
vcs: VCS | null,
|
||||
syncItems: Array<StatusCandidate>,
|
||||
|
||||
@ -429,6 +430,7 @@ class Wrapper extends React.PureComponent<Props, State> {
|
||||
unseenWorkspaces,
|
||||
isVariableUncovered,
|
||||
vcs,
|
||||
headerEditorKey,
|
||||
} = this.props;
|
||||
|
||||
const realSidebarWidth = sidebarHidden ? 0 : sidebarWidth;
|
||||
@ -731,6 +733,7 @@ class Wrapper extends React.PureComponent<Props, State> {
|
||||
handleSendAndDownload={this._handleSendAndDownloadRequestWithActiveEnvironment}
|
||||
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
|
||||
isVariableUncovered={isVariableUncovered}
|
||||
headerEditorKey={headerEditorKey}
|
||||
/>
|
||||
</ErrorBoundary>
|
||||
|
||||
|
@ -90,6 +90,7 @@ class App extends PureComponent {
|
||||
isVariableUncovered: props.isVariableUncovered || false,
|
||||
vcs: null,
|
||||
forceRefreshCounter: 0,
|
||||
forceRefreshHeaderCounter: 0,
|
||||
};
|
||||
|
||||
this._isMigratingChildren = false;
|
||||
@ -508,7 +509,9 @@ class App extends PureComponent {
|
||||
|
||||
// Force it to update, because other editor components (header editor)
|
||||
// needs to change. Need to wait a delay so the next render can finish
|
||||
setTimeout(this._wrapper._forceRequestPaneRefresh, 300);
|
||||
setTimeout(() => {
|
||||
this.setState({ forceRefreshHeaderCounter: this.state.forceRefreshHeaderCounter + 1 });
|
||||
}, 500);
|
||||
|
||||
return newRequest;
|
||||
}
|
||||
@ -1051,6 +1054,7 @@ class App extends PureComponent {
|
||||
isVariableUncovered,
|
||||
vcs,
|
||||
forceRefreshCounter,
|
||||
forceRefreshHeaderCounter,
|
||||
} = this.state;
|
||||
|
||||
const uniquenessKey = `${forceRefreshCounter}::${activeWorkspace._id}`;
|
||||
@ -1103,6 +1107,7 @@ class App extends PureComponent {
|
||||
handleUpdateRequestMimeType={this._handleUpdateRequestMimeType}
|
||||
handleShowExportRequestsModal={this._handleShowExportRequestsModal}
|
||||
isVariableUncovered={isVariableUncovered}
|
||||
headerEditorKey={forceRefreshHeaderCounter + ''}
|
||||
vcs={vcs}
|
||||
/>
|
||||
</ErrorBoundary>
|
||||
|
Loading…
Reference in New Issue
Block a user