Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/WatWowMap/ReactMap into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
TurtIeSocks committed Jan 13, 2024
2 parents d3339ec + e42e5c8 commit 117435b
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 19 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# [1.28.0-develop.10](https://github.com/WatWowMap/ReactMap/compare/v1.28.0-develop.9...v1.28.0-develop.10) (2024-01-12)


### Bug Fixes

* better regex for mapping minified errors ([cd0c28b](https://github.com/WatWowMap/ReactMap/commit/cd0c28b63d809d7c4acb08c58588c6449543c982))
* search translations in webhook tracked ([5ef29ee](https://github.com/WatWowMap/ReactMap/commit/5ef29ee53855fc0065b465dc53915ea21efb91ab))

# [1.28.0-develop.9](https://github.com/WatWowMap/ReactMap/compare/v1.28.0-develop.8...v1.28.0-develop.9) (2024-01-12)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactmap",
"version": "1.28.0-develop.9",
"version": "1.28.0-develop.10",
"private": true,
"description": "React based frontend map.",
"license": "MIT",
Expand Down
9 changes: 4 additions & 5 deletions server/src/routes/rootRouter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const express = require('express')
const fs = require('fs')
const { resolve } = require('path')
const { resolve, join } = require('path')
const { SourceMapConsumer } = require('source-map')
const config = require('@rm/config')
const { log, HELPERS } = require('@rm/logger')
Expand Down Expand Up @@ -52,14 +52,14 @@ rootRouter.post('/api/error/client', async (req, res) => {
? await Promise.all(
stack.split('\n').map(async (stackLine, i) => {
const match = stackLine.match(
/at (.+) \(https?:\/\/([^/]+)\/(.+\.js):(\d+):(\d+)\)/,
/at (.+) \((\/.+\.js):(\d+):(\d+)\)/,
)
log.debug(HELPERS.client, { match, stackLine })
if (match) {
const [full, functionName, host, file, line, column] = match
const [full, functionName, file, line, column] = match
const foundStack = await SourceMapConsumer.with(
await fs.promises.readFile(
resolve(__dirname, '../../../dist', `${file}.map`),
join(__dirname, '../../../dist', `${file}.map`),
'utf8',
),
null,
Expand All @@ -81,7 +81,6 @@ rootRouter.post('/api/error/client', async (req, res) => {
log.warn(HELPERS.client, 'Unable to find source map', {
full,
functionName,
host,
file,
line,
column,
Expand Down
5 changes: 4 additions & 1 deletion src/components/ErrorBoundary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ class ErrorBoundary extends React.Component {
await Fetch.sendError({
cause: error.cause,
message: error.message,
stack: error?.stack,
stack: error?.stack?.replace(
/(http|https):\/\/[a-z0-9.]+(:[0-9]+)?/g,
'',
),
name: error.name,
uuid: this.state.uuid,
})
Expand Down
6 changes: 3 additions & 3 deletions src/components/QueryData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const trimFilters = (requestedFilters, userSettings, category, onlyAreas) => {
onlyAllPvp: userSettings?.showAllPvpRanks,
onlyAreas: onlyAreas || [],
}
Object.entries(requestedFilters).forEach((topLevelFilter) => {
Object.entries(requestedFilters || {}).forEach((topLevelFilter) => {
const [id, specifics] = topLevelFilter

if (!FILTER_SKIP_LIST.includes(id)) {
Expand All @@ -62,7 +62,7 @@ const trimFilters = (requestedFilters, userSettings, category, onlyAreas) => {
entryV
}
})
Object.entries(requestedFilters.filter).forEach(([id, specifics]) => {
Object.entries(requestedFilters?.filter || {}).forEach(([id, specifics]) => {
// eslint-disable-next-line no-unused-vars
const { enabled, size, ...rest } = (easyMode
? requestedFilters.ivOr
Expand Down Expand Up @@ -107,7 +107,7 @@ function QueryData({ category, timeout }) {
const userSettings = useStorage(
(s) => s.userSettings[userSettingsCategory(category)],
)
const filters = useStorage((s) => s.filters[category])
const filters = useStorage((s) => s.filters?.[category])
const onlyAreas = useStorage(
(s) =>
s.filters?.scanAreas?.filterByAreas &&
Expand Down
6 changes: 3 additions & 3 deletions src/components/layout/dialogs/filters/Advanced.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function AdvancedFilter() {
)
const easyMode = useStorage((s) => !!s.filters?.[category]?.easyMode)
const [filters, setFilters] = useDeepStore(
`filters.${category}.filter.${id}`,
category ? `filters.${category}.filter.${id}` : `filters.gyms.standard`,
standard,
)
const backup = React.useRef(filters)
Expand Down Expand Up @@ -77,7 +77,7 @@ export default function AdvancedFilter() {
}))
if (!save) {
setFilters({ ...backup.current })
} else if (id === 'global' && selectedIds?.length) {
} else if (id === 'global' && selectedIds?.length && category) {
applyToAll(true, category, selectedIds, false)
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ export default function AdvancedFilter() {
if (open) backup.current = filters
}, [open])

if (!id) return null
if (!id || !category) return null
const showMoreFilters = category === 'pokemon' && !easyMode
return (
<Dialog
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/dialogs/filters/FilterMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DialogWrapper } from '../DialogWrapper'

export default function FilterMenu() {
const { open, category, type } = useLayoutStore((s) => s.dialog)
const filters = useStorage((s) => s.filters[category])
const filters = useStorage((s) => s.filters?.[category])

const [tempFilters, setTempFilters] = React.useState(filters?.filter)

Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/dialogs/filters/SlotSelection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export default function SlotSelection() {
}, basicEqualFn)
const slots = useMemory(
(s) =>
Object.keys(s.filters.gyms.filter).filter(
Object.keys(s.filters?.gyms?.filter || {}).filter(
(g) => g.startsWith('g') && g.charAt(1) === teamId,
),
basicEqualFn,
)
const disabled = useStorage((s) => s.filters.gyms.filter[id]?.all)
const disabled = useStorage((s) => !!s.filters?.gyms?.filter?.[id]?.all)

/** @type {(value: boolean | import('packages/types/lib').BaseFilter['size'], team: string) => void} */
const handleSizeChange = React.useCallback(
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/dialogs/webhooks/Tracked.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const WebhookSearch = React.memo(() => {
setValue={(newValue) =>
useWebhookStore.setState({ trackedSearch: newValue })
}
label={`search_${category}`}
label={`search_${category}${category === 'pokemon' ? '' : 's'}`}
/>
)
})
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useLayoutStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useStorage } from './useStorage'
* drawer: boolean,
* advancedFilter: {
* open: boolean,
* category: import('@rm/types').AdvCategories,
* category: import('@rm/types').AdvCategories | '',
* id: string,
* selectedIds: string[],
* },
Expand Down Expand Up @@ -51,7 +51,7 @@ export const useLayoutStore = create(() => ({
slotSelection: '',
advancedFilter: {
open: false,
category: 'pokemon',
category: '',
id: '',
selectedIds: [],
},
Expand Down

0 comments on commit 117435b

Please sign in to comment.