Skip to content

Commit ffdc40e

Browse files
committed
fix pasting state in results
1 parent e638512 commit ffdc40e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

webdriver-ts-results/src/reducer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export const sort = (sortKey: string): SortAction => {
210210
interface SetStateFromClipboardAction { type: 'SET_STATE_FROM_CLIPBOARD'; data: any }
211211
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
212212
export const setStateFromClipboard = (state: any): SetStateFromClipboardAction => {
213-
return { type: 'SET_STATE_FROM_CLIPBOARD', data: { state } }
213+
return { type: 'SET_STATE_FROM_CLIPBOARD', data: state }
214214
}
215215

216216
type Action = SelectFrameworkAction | SelectAllFrameworksAction | SelectBenchmarkAction | SelectAllBenchmarksAction
@@ -221,7 +221,7 @@ export const reducer = (state = initialState, action: Action): State => {
221221
console.log("reducer", action)
222222
switch (action.type) {
223223
case 'SET_STATE_FROM_CLIPBOARD': {
224-
if (action.data.state) {
224+
if (action.data) {
225225
const t = { ...state, ...extractState(action.data) };
226226
return { ...t, resultTables: updateResultTable(t) }
227227
} else {

webdriver-ts-results/src/selection/CopyPasteSelection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const CopyPasteSelection = (): JSX.Element =>
2222
};
2323
const paste = async () => {
2424
try {
25-
const jsonState = JSON.parse(await navigator.clipboard.readText());
25+
const text = await navigator.clipboard.readText();
26+
const jsonState = JSON.parse(text);
2627
dispatch(setStateFromClipboard(jsonState));
2728
} catch (e) {
2829
alert("Sorry - couldn't parse pasted selection");

webdriver-ts-results/table.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)