Skip to content

Commit

Permalink
changeURLMiddleware: respect pathnameShouldBe: ""
Browse files Browse the repository at this point in the history
Prompted by @jameshadfield's review comment.¹
Fixes bug where ` pathnameShouldBe: ""` was ignored because `""` is
falsey. I chose to check `typeof` instead of `action.hasOwnProperty`
because I found cases where `pathnameShouldBe` can potentially
be set to `undefined`.²

¹ <#1804 (comment)>
² <https://github.com/nextstrain/auspice/blob/84a15484acabee10a65d2d4138f83e51ae068b51/src/actions/loadData.js#L128>
  • Loading branch information
joverlee521 committed Aug 6, 2024
1 parent dbfce23 commit a9c4610
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/middleware/changeURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const changeURLMiddleware = (store) => (next) => (action) => {
/* second switch: path change */
switch (action.type) {
case types.CLEAN_START:
if (action.pathnameShouldBe && !action.narrative) {
if (typeof action.pathnameShouldBe === "string" && !action.narrative) {
pathname = action.pathnameShouldBe;
break;
}
Expand Down

0 comments on commit a9c4610

Please sign in to comment.