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,
|
isVariableUncovered: boolean,
|
||||||
environmentId: string,
|
environmentId: string,
|
||||||
forceRefreshCounter: number,
|
forceRefreshCounter: number,
|
||||||
|
headerEditorKey: string,
|
||||||
|
|
||||||
// Optional
|
// Optional
|
||||||
request: ?Request,
|
request: ?Request,
|
||||||
@ -165,6 +166,7 @@ class RequestPane extends React.PureComponent<Props> {
|
|||||||
updateSettingsShowPasswords,
|
updateSettingsShowPasswords,
|
||||||
updateRequestMethod,
|
updateRequestMethod,
|
||||||
updateRequestUrl,
|
updateRequestUrl,
|
||||||
|
headerEditorKey,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const paneClasses = 'request-pane theme--pane pane';
|
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">
|
<TabPanel className="react-tabs__tab-panel header-editor">
|
||||||
<ErrorBoundary key={uniqueKey} errorClassName="font-error pad text-center">
|
<ErrorBoundary key={uniqueKey} errorClassName="font-error pad text-center">
|
||||||
<RequestHeadersEditor
|
<RequestHeadersEditor
|
||||||
|
key={headerEditorKey}
|
||||||
handleRender={handleRender}
|
handleRender={handleRender}
|
||||||
handleGetRenderContext={handleGetRenderContext}
|
handleGetRenderContext={handleGetRenderContext}
|
||||||
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
|
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
|
||||||
|
@ -128,6 +128,7 @@ type Props = {
|
|||||||
activeEnvironment: Environment | null,
|
activeEnvironment: Environment | null,
|
||||||
activeWorkspaceClientCertificates: Array<ClientCertificate>,
|
activeWorkspaceClientCertificates: Array<ClientCertificate>,
|
||||||
isVariableUncovered: boolean,
|
isVariableUncovered: boolean,
|
||||||
|
headerEditorKey: string,
|
||||||
vcs: VCS | null,
|
vcs: VCS | null,
|
||||||
syncItems: Array<StatusCandidate>,
|
syncItems: Array<StatusCandidate>,
|
||||||
|
|
||||||
@ -429,6 +430,7 @@ class Wrapper extends React.PureComponent<Props, State> {
|
|||||||
unseenWorkspaces,
|
unseenWorkspaces,
|
||||||
isVariableUncovered,
|
isVariableUncovered,
|
||||||
vcs,
|
vcs,
|
||||||
|
headerEditorKey,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const realSidebarWidth = sidebarHidden ? 0 : sidebarWidth;
|
const realSidebarWidth = sidebarHidden ? 0 : sidebarWidth;
|
||||||
@ -731,6 +733,7 @@ class Wrapper extends React.PureComponent<Props, State> {
|
|||||||
handleSendAndDownload={this._handleSendAndDownloadRequestWithActiveEnvironment}
|
handleSendAndDownload={this._handleSendAndDownloadRequestWithActiveEnvironment}
|
||||||
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
|
nunjucksPowerUserMode={settings.nunjucksPowerUserMode}
|
||||||
isVariableUncovered={isVariableUncovered}
|
isVariableUncovered={isVariableUncovered}
|
||||||
|
headerEditorKey={headerEditorKey}
|
||||||
/>
|
/>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ class App extends PureComponent {
|
|||||||
isVariableUncovered: props.isVariableUncovered || false,
|
isVariableUncovered: props.isVariableUncovered || false,
|
||||||
vcs: null,
|
vcs: null,
|
||||||
forceRefreshCounter: 0,
|
forceRefreshCounter: 0,
|
||||||
|
forceRefreshHeaderCounter: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
this._isMigratingChildren = false;
|
this._isMigratingChildren = false;
|
||||||
@ -508,7 +509,9 @@ class App extends PureComponent {
|
|||||||
|
|
||||||
// Force it to update, because other editor components (header editor)
|
// Force it to update, because other editor components (header editor)
|
||||||
// needs to change. Need to wait a delay so the next render can finish
|
// 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;
|
return newRequest;
|
||||||
}
|
}
|
||||||
@ -1051,6 +1054,7 @@ class App extends PureComponent {
|
|||||||
isVariableUncovered,
|
isVariableUncovered,
|
||||||
vcs,
|
vcs,
|
||||||
forceRefreshCounter,
|
forceRefreshCounter,
|
||||||
|
forceRefreshHeaderCounter,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
const uniquenessKey = `${forceRefreshCounter}::${activeWorkspace._id}`;
|
const uniquenessKey = `${forceRefreshCounter}::${activeWorkspace._id}`;
|
||||||
@ -1103,6 +1107,7 @@ class App extends PureComponent {
|
|||||||
handleUpdateRequestMimeType={this._handleUpdateRequestMimeType}
|
handleUpdateRequestMimeType={this._handleUpdateRequestMimeType}
|
||||||
handleShowExportRequestsModal={this._handleShowExportRequestsModal}
|
handleShowExportRequestsModal={this._handleShowExportRequestsModal}
|
||||||
isVariableUncovered={isVariableUncovered}
|
isVariableUncovered={isVariableUncovered}
|
||||||
|
headerEditorKey={forceRefreshHeaderCounter + ''}
|
||||||
vcs={vcs}
|
vcs={vcs}
|
||||||
/>
|
/>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
|
Loading…
Reference in New Issue
Block a user