Skip to content

Commit

Permalink
remove pre-req logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkav committed May 17, 2024
1 parent fa5afc5 commit 18723c4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
14 changes: 1 addition & 13 deletions packages/insomnia/src/network/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,9 @@ export const tryToExecutePreRequestScript = async (
// TODO: restart the hidden browser window
}, timeout + 1000);
});
// const requestGroups = await db.withAncestors<Request | RequestGroup>(request, [
// models.requestGroup.type,
// ]) as (Request | RequestGroup)[];

// const folderScripts = requestGroups.reverse()
// .filter(group => group?.preRequestScript)
// .map((group, i) => `const fn${i} = async ()=>{
// ${group.preRequestScript}
// }
// await fn${i}();
// `);
const joinedScript = request.preRequestScript;// [...folderScripts].join('\n');

const preRequestPromise = cancellableRunPreRequestScript({
script: joinedScript,
script: request.preRequestScript,
context: {
request,
timelinePath,
Expand Down
30 changes: 0 additions & 30 deletions packages/insomnia/src/ui/components/panes/request-group-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { useRouteLoaderData } from 'react-router-dom';

import { Settings } from '../../../models/settings';
import { useActiveRequestSyncVCSVersion, useGitVCSVersion } from '../../hooks/use-vcs-version';
// import { useRequestGroupPatcher } from '../../hooks/use-request';
import { RequestGroupLoaderData } from '../../routes/request-group';
import { WorkspaceLoaderData } from '../../routes/workspace';
import { PanelContainer, TabItem, Tabs } from '../base/tabs';
import { AuthDropdown } from '../dropdowns/auth-dropdown';
import { AuthWrapper } from '../editors/auth/auth-wrapper';
// import { PreRequestScriptEditor } from '../editors/pre-request-script-editor';
import { ErrorBoundary } from '../error-boundary';
import { MarkdownPreview } from '../markdown-preview';
import { RequestGroupSettingsModal } from '../modals/request-group-settings-modal';
Expand All @@ -18,7 +16,6 @@ export const RequestGroupPane: FC<{ settings: Settings }> = ({ }) => {
const { activeRequestGroup } = useRouteLoaderData('request-group/:requestGroupId') as RequestGroupLoaderData;
const { activeEnvironment } = useRouteLoaderData(':workspaceId') as WorkspaceLoaderData;
const [isRequestGroupSettingsModalOpen, setIsRequestGroupSettingsModalOpen] = useState(false);
// const patchRequestGroup = useRequestGroupPatcher();
const gitVersion = useGitVCSVersion();
const activeRequestSyncVersion = useActiveRequestSyncVCSVersion();
const uniqueKey = `${activeEnvironment?.modified}::${activeRequestGroup._id}::${gitVersion}::${activeRequestSyncVersion}`;
Expand Down Expand Up @@ -92,33 +89,6 @@ export const RequestGroupPane: FC<{ settings: Settings }> = ({ }) => {
)}
</PanelContainer>
</TabItem>
{/* <TabItem
key="pre-request-script"
data-testid="pre-request-script-tab"
title={
<div className='flex items-center gap-2'>
Pre-request Script{' '}
{activeRequestGroup.preRequestScript && (
<span className="ml-2 p-2 border-solid border border-[--hl-md] rounded-lg">
<span className="flex w-2 h-2 bg-green-500 rounded-full" />
</span>
)}
</div>
}
aria-label={'experimental'}
>
<ErrorBoundary
key={uniqueKey}
errorClassName="tall wide vertically-align font-error pad text-center"
>
<PreRequestScriptEditor
uniquenessKey={uniqueKey}
defaultValue={activeRequestGroup.preRequestScript || ''}
onChange={preRequestScript => patchRequestGroup(activeRequestGroup._id, { preRequestScript })}
settings={settings}
/>
</ErrorBoundary>
</TabItem> */}
</Tabs>
{isRequestGroupSettingsModalOpen && (
<RequestGroupSettingsModal
Expand Down

0 comments on commit 18723c4

Please sign in to comment.