Skip to content

Commit

Permalink
Merge pull request #22 from lidofinance/feature/si-718-bug-in-usedebo…
Browse files Browse the repository at this point in the history
…uncedvalue

fix: rpc call and debounce bug
  • Loading branch information
itaven authored Aug 21, 2023
2 parents 9e3a2cd + b9ecd69 commit 72ec8d0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
10 changes: 9 additions & 1 deletion pages/api/csp-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ import { defaultErrorHandler, rateLimit } from 'utilsApi';
import { API } from 'types';

const cspReport: API = async (req, res) => {
let violation = {};

if (typeof req.body == 'object') {
violation = req.body;
} else if (typeof req.body === 'string') {
violation = JSON.parse(req.body);
}

console.warn({
type: 'CSP Violation',
...req.body,
...violation,
});

res.status(200).send({ status: 'ok' });
Expand Down
2 changes: 1 addition & 1 deletion shared/hooks/useDebouncedValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const useDebouncedValue = <T>(value: T, delay: number) => {
const deb = useMemo(() => debounce((_v) => s(_v), delay), [delay]);
deb(value);
useEffect(() => {
() => {
return () => {
deb.flush();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
12 changes: 0 additions & 12 deletions test/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,6 @@ export const GET_REQUESTS: GetRequest[] = [
},
},
},
{
uri: '/api/health',
schema: {
type: 'object',
properties: {
status: {
type: 'string',
const: 'ok',
},
},
},
},
{
uri: '/api/sma-steth-apr',
schema: {
Expand Down
2 changes: 1 addition & 1 deletion utils/getFeeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const getFeeHistory = (
percentile: number[],
) => {
return provider.send('eth_feeHistory', [
blockCount.toString(16),
'0x' + blockCount.toString(16),
latestBlock,
percentile,
]) as Promise<{
Expand Down

0 comments on commit 72ec8d0

Please sign in to comment.