mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-08 06:28:33 +00:00
fix: example-request tab collision (#7989)
* fix: prevent response-example tabs from hijacking request sidebar selection * fix: add selectors for examples with index * test: better locator * fix: duplicate name collision * fix: refactor sidebar example handling functions for better clarity and reusability * chore: cr comments
This commit is contained in:
@@ -28,11 +28,13 @@ const buildWorkspaceCollectionLookupKey = (workspacePathname, collectionPathname
|
||||
|
||||
const tabSchema = yup.object({
|
||||
type: yup.string().required(),
|
||||
accessor: yup.string().oneOf(['pathname', 'pathname::exampleName', 'type']).required(),
|
||||
accessor: yup.string().oneOf(['pathname', 'pathname::exampleName', 'pathname::exampleIndex', 'type']).required(),
|
||||
pathname: yup.string().nullable(),
|
||||
permanent: yup.boolean().required(),
|
||||
name: yup.string().optional(),
|
||||
exampleName: yup.string().optional(),
|
||||
exampleIndex: yup.number().integer().min(0).optional(),
|
||||
exampleUid: yup.string().optional(),
|
||||
request: yup.object({
|
||||
tab: yup.string(),
|
||||
width: yup.number().nullable(),
|
||||
@@ -46,7 +48,7 @@ const tabSchema = yup.object({
|
||||
});
|
||||
|
||||
const activeTabSchema = yup.object({
|
||||
accessor: yup.string().oneOf(['pathname', 'pathname::exampleName', 'type']).required(),
|
||||
accessor: yup.string().oneOf(['pathname', 'pathname::exampleName', 'pathname::exampleIndex', 'type']).required(),
|
||||
value: yup.string().required()
|
||||
});
|
||||
|
||||
@@ -500,7 +502,7 @@ class SnapshotManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!['pathname', 'pathname::exampleName', 'type'].includes(activeTab.accessor) || typeof activeTab.value !== 'string') {
|
||||
if (!['pathname', 'pathname::exampleName', 'pathname::exampleIndex', 'type'].includes(activeTab.accessor) || typeof activeTab.value !== 'string') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user