@@ -1,6 +1,4 @@
1−import ob from 'urbit-ob';
1+import { useMemo } from 'react';
3−import { ensurePatFormat } from 'form/formatters';
5// looks into the GET parameters and attempts to construct a "flow" object,
3// looks into the GET parameters and attempts to construct a "flow" object,
6// which would indicate bridge is to be used for one specific flow.
4// which would indicate bridge is to be used for one specific flow.
@@ -17,28 +15,33 @@ const COMMANDS = {
19const useFlowCommand = () => {
17const useFlowCommand = () => {
18+ const flow = useMemo(() => {
20− let flow = {};
19+ let flow = {};
21− window.location.search
21+ window.location.search
22− .substr(1)
22+ .substr(1)
23− .split('&')
23+ .split('&')
24− .forEach(arg => {
24+ .forEach(arg => {
25− if ('' === arg) return;
25+ if ('' === arg) return;
26− const pam = arg.split('=');
26+ const pam = arg.split('=');
27− flow[pam[0]] = pam.length <= 1 ? true : decodeURIComponent(pam[1]);
27+ flow[pam[0]] = pam.length <= 1 ? true : decodeURIComponent(pam[1]);
30− if (typeof flow === 'object') {
30+ if (typeof flow === 'object') {
31− switch (flow.kind) {
31+ switch (flow.kind) {
33− console.log('unrecognized kind of flow:', flow.kind);
33+ console.log('unrecognized kind of flow:', flow.kind);
34− // eslint-disable-next-line no-fallthrough
34+ // eslint-disable-next-line no-fallthrough
35− case undefined:
35+ case undefined:
36− flow = null;
36+ flow = null;
40− flow = null;
43+ return flow;
43 return flow;
46 return flow;