Skip to content

Commit

Permalink
Merge pull request #1804 from ruanhan/dev-0.3
Browse files Browse the repository at this point in the history
fix(shareparam) #1796
  • Loading branch information
scottsut authored Jun 15, 2020
2 parents 3dce91f + c5b7592 commit 56d9990
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions webapp/share/containers/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,25 @@ export class Share extends React.Component<IDashboardProps, IDashboardStates> {

private deep_set(o, path, value) {
let i = 0
const val = decodeURIComponent(value)
for (; i < path.length - 1; i++) {
if (o[path[i]] === undefined) {
o[decodeURIComponent(path[i])] = path[i + 1].match(/^\d+$/) ? [] : {}
}
o = o[decodeURIComponent(path[i])]
if (o[path[i]] === undefined) {
o[decodeURIComponent(path[i])] = path[i + 1].match(/^\d+$/) ? [] : {}
}
o = o[decodeURIComponent(path[i])]
}
if (o[decodeURIComponent(path[i])] && o[decodeURIComponent(path[i])].length) {
const isInclude =
Array.isArray(o[decodeURIComponent(path[i])]) &&
o[decodeURIComponent(path[i])].includes(val)

const isEqual = o[decodeURIComponent(path[i])] === val
if (!(isInclude || isEqual)) {
o[decodeURIComponent(path[i])] = [val].concat(o[decodeURIComponent(path[i])])
}
} else {
o[decodeURIComponent(path[i])] = val
}
o[decodeURIComponent(path[i])] = decodeURIComponent(value)
}

private initPolling = (token) => {
Expand Down

0 comments on commit 56d9990

Please sign in to comment.