We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1dcbe32 commit ff1ae3aCopy full SHA for ff1ae3a
src/cache.ts
@@ -12,8 +12,16 @@ export const getCacheKey = async (props: GetCacheKeyProps): Promise<string> => {
12
// https://stackoverflow.com/a/40924449
13
const propsWithoutUndefined = Object.keys(props).reduce((acc, key) => {
14
const _acc: Record<string, any> = acc;
15
- const propValue = (props as any)[key];
16
- if (propValue != null && propValue !== '') {
+ let propValue = (props as any)[key];
+ if (key === 'body' && propValue !== '') {
17
+ try {
18
+ const body = JSON.parse(propValue);
19
+ propValue = JSON.stringify(body, Object.keys(body).sort());
20
+ } catch (_error) {
21
+ propValue = '';
22
+ }
23
24
+ if (propValue !== null && propValue !== '') {
25
_acc[key] = propValue;
26
}
27
return _acc;
0 commit comments