on master help sign in
grants: make query assignment reactive
aa483a6Matilde Park
pages/grants.js+6−11
@@ -72,25 +72,20 @@ export default function Grants({
72 gifts,
72 gifts,
73}) {
73}) {
74 const router = useRouter();
74 const router = useRouter();
75+ const { open, completed, program, wip } = router.query;
75 const [activeTags, setTags] = useState([]);
76 const [activeTags, setTags] = useState([]);
76 const [activeTypes, setTypes] = useState(types);
77 const [activeTypes, setTypes] = useState(types);
77− const includeOpen =
78+ const includeOpen = open === "true";
78− router.query.open === undefined || router.query.open === "true";
79− const includeCompleted = router.query.completed === "true";
79+ const includeCompleted = completed === "true";
80− const programFilter = router.query.program;
80+ const programFilter = program;
81 const post = {
81 const post = {
82 title: "Grants",
82 title: "Grants",
83 description: "Contribute to the Urbit project while earning address space.",
83 description: "Contribute to the Urbit project while earning address space.",
84 };
84 };
85
85
86− let includeInProgress =
86+ let includeInProgress = wip === undefined || wip === "true";
87− router.query.wip === undefined || router.query.wip === "true";
88
87
89− if (
90− router.query.open === undefined &&
91− router.query.completed === undefined &&
88+ if (open === undefined && completed === undefined && wip === undefined) {
92− router.query.wip === undefined
93− ) {
94 includeInProgress = true;
89 includeInProgress = true;
95 }
90 }
96
91