mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 09:08:32 +02:00
Fix Editor.tsx wonkiness
This commit is contained in:
@@ -265,7 +265,6 @@ export function GrpcRequestPane({
|
|||||||
</HStack>
|
</HStack>
|
||||||
</div>
|
</div>
|
||||||
<Tabs
|
<Tabs
|
||||||
key={forceUpdateKey}
|
|
||||||
value={activeTab}
|
value={activeTab}
|
||||||
label="Request"
|
label="Request"
|
||||||
onChangeValue={setActiveTab}
|
onChangeValue={setActiveTab}
|
||||||
|
|||||||
@@ -354,7 +354,6 @@ export function HttpRequestPane({ style, fullHeight, className, activeRequest }:
|
|||||||
isLoading={activeResponse != null && activeResponse.state !== 'closed'}
|
isLoading={activeResponse != null && activeResponse.state !== 'closed'}
|
||||||
/>
|
/>
|
||||||
<Tabs
|
<Tabs
|
||||||
key={activeRequest.id} // Freshen tabs on request change
|
|
||||||
value={activeTab}
|
value={activeTab}
|
||||||
label="Request"
|
label="Request"
|
||||||
onChangeValue={setActiveTab}
|
onChangeValue={setActiveTab}
|
||||||
|
|||||||
@@ -229,7 +229,6 @@ export function WebsocketRequestPane({ style, fullHeight, className, activeReque
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Tabs
|
<Tabs
|
||||||
key={activeRequest.id} // Freshen tabs on request change
|
|
||||||
value={activeTab}
|
value={activeTab}
|
||||||
label="Request"
|
label="Request"
|
||||||
onChangeValue={setActiveTab}
|
onChangeValue={setActiveTab}
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ export function Editor({
|
|||||||
|
|
||||||
// Initialize the editor when ref mounts
|
// Initialize the editor when ref mounts
|
||||||
const initEditorRef = useCallback(
|
const initEditorRef = useCallback(
|
||||||
function initializeCodemirror(container: HTMLDivElement | null) {
|
function initEditorRef(container: HTMLDivElement | null) {
|
||||||
if (container === null) {
|
if (container === null) {
|
||||||
cm.current?.view.destroy();
|
cm.current?.view.destroy();
|
||||||
cm.current = null;
|
cm.current = null;
|
||||||
@@ -455,17 +455,9 @@ export function Editor({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
[],
|
[forceUpdateKey],
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update editor doc when force update key changes
|
|
||||||
useEffect(() => {
|
|
||||||
if (cm.current?.view != null) {
|
|
||||||
updateContents(cm.current.view, defaultValue || '');
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [forceUpdateKey]);
|
|
||||||
|
|
||||||
// For read-only mode, update content when `defaultValue` changes
|
// For read-only mode, update content when `defaultValue` changes
|
||||||
useEffect(
|
useEffect(
|
||||||
function updateReadOnlyEditor() {
|
function updateReadOnlyEditor() {
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ function fieldValueCompletions(
|
|||||||
): Completion[] | null {
|
): Completion[] | null {
|
||||||
if (!def || !def.values) return null;
|
if (!def || !def.values) return null;
|
||||||
const vals = Array.isArray(def.values) ? def.values : def.values();
|
const vals = Array.isArray(def.values) ? def.values : def.values();
|
||||||
// console.log("HELLO", v, v.match(IDENT));
|
|
||||||
return vals.map((v) => ({
|
return vals.map((v) => ({
|
||||||
label: v.match(IDENT_ONLY) ? v : `"${v}"`,
|
label: v.match(IDENT_ONLY) ? v : `"${v}"`,
|
||||||
displayLabel: v,
|
displayLabel: v,
|
||||||
|
|||||||
Reference in New Issue
Block a user