Merge pull request #552 from vector-im/dbkr/fix_rageshake_groupcall_txt
Fix groupcall debug info in rageshakes
This commit is contained in:
commit
10a2733fd5
2 changed files with 13 additions and 6 deletions
|
@ -121,8 +121,11 @@ export function InspectorContextProvider({
|
||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
// The context will be initialized empty.
|
// We take the tuple of [currentState, setter] and stick
|
||||||
// It is then set from within GroupCallInspector.
|
// it straight into the context for other things to call
|
||||||
|
// the setState method... this feels like a fairly severe
|
||||||
|
// contortion of the hooks API - is this really the best way
|
||||||
|
// to do this?
|
||||||
const context = useState<InspectorContextState>({});
|
const context = useState<InspectorContextState>({});
|
||||||
return (
|
return (
|
||||||
<InspectorContext.Provider value={context}>
|
<InspectorContext.Provider value={context}>
|
||||||
|
|
|
@ -40,7 +40,9 @@ export function useSubmitRageshake(): {
|
||||||
error: Error;
|
error: Error;
|
||||||
} {
|
} {
|
||||||
const client: MatrixClient = useClient().client;
|
const client: MatrixClient = useClient().client;
|
||||||
const json = useContext(InspectorContext);
|
// The value of the context is the whole tuple returned from setState,
|
||||||
|
// so we just want the current state.
|
||||||
|
const [inspectorState] = useContext(InspectorContext);
|
||||||
|
|
||||||
const [{ sending, sent, error }, setState] = useState({
|
const [{ sending, sent, error }, setState] = useState({
|
||||||
sending: false,
|
sending: false,
|
||||||
|
@ -231,10 +233,12 @@ export function useSubmitRageshake(): {
|
||||||
body.append("compressed-log", new Blob([buf]), entry.id);
|
body.append("compressed-log", new Blob([buf]), entry.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json) {
|
if (inspectorState) {
|
||||||
body.append(
|
body.append(
|
||||||
"file",
|
"file",
|
||||||
new Blob([JSON.stringify(json)], { type: "text/plain" }),
|
new Blob([JSON.stringify(inspectorState)], {
|
||||||
|
type: "text/plain",
|
||||||
|
}),
|
||||||
"groupcall.txt"
|
"groupcall.txt"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +266,7 @@ export function useSubmitRageshake(): {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[client, json, sending]
|
[client, inspectorState, sending]
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue