Skip to content

Commit

Permalink
fix: Check array index access
Browse files Browse the repository at this point in the history
Actual fix was done during refactoring to monorepo,
highlighting it here for SemRel.
  • Loading branch information
franky47 committed Oct 13, 2023
1 parent 5f0dcc0 commit 73c120c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/next-usequerystate/src/parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export function createParser<T>(parser: Required<Parser<T>>): ParserBuilder<T> {
if (Array.isArray(value)) {
// Follow the spec:
// https://url.spec.whatwg.org/#dom-urlsearchparams-get
// if (value[0] === undefined) {
// return null
// }
if (value[0] === undefined) {
return null
}
str = value[0]
}
if (typeof value === 'string') {
Expand Down
6 changes: 3 additions & 3 deletions packages/next-usequerystate/src/useQueryStates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ export function useQueryStates<KeyMap extends UseQueryStatesKeysMap>(
)
for (const [key, value] of Object.entries(newState)) {
const config = keyMap[key]
// if (!config) {
// continue
// }
if (!config) {
continue
}
emitter.emit(key, value)
__DEBUG__ &&
console.debug(
Expand Down

0 comments on commit 73c120c

Please sign in to comment.