Version 3.1.0 is not working in React-Native when is not in debugging mode or when is generating release
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, react-native
- 領域
- mobile
調査の方向性
まず、serialize-javascript 3.1.0 を使用した React-Native のリリースビルドで報告されたエラーを再現し、その後、バージョン 3.0.0 と動作を比較します。安全な乱数生成エラーの発生源を追跡し、デバッグなしの React-Native 実行で結果を確認します。シリアライズがデバッガーなしで機能すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hello, I'm using serialize-javascript in React-Native instead of JSON.stringify function. The version 3.1.0 is not working in React-Native when the debugger is off or in the release apk (because there is no debugger).
The issue is:
Error: Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11.
Reproduce:
- In React-Native project install with npm, npx or yarn the package serialize-javascript.
- Create a serialize function:
import serializeJs from 'serialize-javascript';
...
const clearArrayUndefinedValues = (array) => {
try {
if (!Array.isArray(array))
throw new Error('Invalid argument. Must be an array.');
const filteredArr = array.reduce((arr, current) => {
if (typeof current === 'object' && current !== null) {
if (Array.isArray(current))
return [...arr, clearArrayUndefinedValues(current)];
// eslint-disable-next-line no-use-before-define
return [...arr, clearObjectUndefinedValues(current)];
} else if (current !== undefined) return [...arr, current];
return arr;
}, []);
return filteredArr;
} catch (error) {
console.log(
'##\t Error log in clearArrayUndefinedValues on app/shared/utils.js ->',
error
);
return null;
}
};
const clearObjectUndefinedValues = (object) => {
try {
if (typeof object !== 'object')
throw new Error('Invalid argument. Must be an object.');
if (object === null) throw new Error('Invalid argument. Must not be null.');
const filtered = Object.keys(object).reduce((obj, key) => {
const { [key]: current } = object;
if (typeof current === 'object' && current !== null) {
if (Array.isArray(current))
return { ...obj, [key]: clearArrayUndefinedValues(current) };
return { ...obj, [key]: clearObjectUndefinedValues(current) };
} else if (current !== undefined) return { ...obj, [key]: current };
return obj;
}, {});
return filtered;
} catch (error) {
console.log(
'##\t Error log in clearObjectUndefinedValues on app/shared/utils.js ->',
error
);
return null;
}
};
export const serialize = (object) => {
try {
if (typeof object !== 'object')
throw new Error('Invalid argument. Must be an object.');
if (object === null) throw new Error('Invalid argument. Must not be null.');
if (Array.isArray(object))
return serializeJs(clearArrayUndefinedValues(object));
return serializeJs(clearObjectUndefinedValues(object));
} catch (error) {
console.log('##\t Error log in serialize on app/shared/utils.js ->', error);
return null;
}
};
- Use a serialize function in any place of your code:
import { serialize } from '../shared/utils';
...
const JSONToObject = serialize(data);
My set is:
MacOs 10.15.5
i7 2.2Ghz
16GB
Running app in simulators:
iPhone 11 os 13.5
Pixel 3 os Android API 29.
Chrome version:
83.0.4103.61 64 bits
The previous version (3.0.0) working well. There are a prevision/way to fix this to work without debugger?
- 主要言語
- JavaScript
- スター
- 2.9k
- フォーク
- 215
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 2
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
yahoo/serialize-javascript のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
yahoo/serialize-javascript#230 ·
-
Ad java script オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
yahoo/serialize-javascript#212 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
yahoo/serialize-javascript#208 · コメント 10 件 · リアクション 25 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
yahoo/serialize-javascript#195 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
yahoo/serialize-javascript#182 ·
yahoo/serialize-javascript の issue をすべて見る
似ている issue
-
bug confirmed issue
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
open-webui/open-webui#30750 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Mend: dependency security vulnerability untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100