From de85938b9073fea6f8414479de8d03cca12bab69 Mon Sep 17 00:00:00 2001 From: Craig Kochis Date: Thu, 31 Oct 2024 10:34:45 -0400 Subject: [PATCH] Fix react ref bug in debug mode (#187) * fix bug when logging react ref in debug mode * bump beta version * just log object instead of stringifying in debug logs * bump version --- README.md | 14 +++++++------- package-lock.json | 2 +- package.json | 2 +- src/api.ts | 2 +- src/logger.ts | 4 ++-- src/ui/RadarMap.ts | 2 +- src/ui/autocomplete.ts | 2 +- src/version.ts | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 8896dceb..44d745da 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ }); Add the following script in your `html` file ```html - + ``` Then initialize the Radar SDK @@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then ```html - - + + @@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis ```html - - + + @@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper ```html - - + + diff --git a/package-lock.json b/package-lock.json index f990b774..8cb7dbaa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "radar-sdk-js", - "version": "4.4.5", + "version": "4.4.6-beta.1", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 329eb411..db02d316 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "radar-sdk-js", - "version": "4.4.5", + "version": "4.4.6-beta.1", "description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.", "homepage": "https://radar.com", "type": "module", diff --git a/src/api.ts b/src/api.ts index 50cdc037..93e3dc6c 100644 --- a/src/api.ts +++ b/src/api.ts @@ -76,7 +76,7 @@ class Radar { Logger.info(`initialized with ${live ? 'live' : 'test'} publishableKey.`); if (options.debug) { - Logger.info(`using options: ${JSON.stringify(options)}`); + Logger.debug('using options', options); } // NOTE(jasonl): this allows us to run jest tests diff --git a/src/logger.ts b/src/logger.ts index 71bf4da9..21701ea9 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -27,9 +27,9 @@ const getLevel = (): number => { } class Logger { - public static debug(message: string) { + public static debug(message: string, options?: any) { if (getLevel() === LOG_LEVELS.debug) { - console.log(`Radar SDK (debug): ${message.trim()}`); + console.log(`Radar SDK (debug): ${message.trim()}`, options); } } diff --git a/src/ui/RadarMap.ts b/src/ui/RadarMap.ts index 4ccfcbdf..7d04429a 100644 --- a/src/ui/RadarMap.ts +++ b/src/ui/RadarMap.ts @@ -96,7 +96,7 @@ class RadarMap extends maplibregl.Map { radarMapOptions, { style }, ); - Logger.debug(`initialize map with options: ${JSON.stringify(mapOptions)}`); + Logger.debug('map initailized with options', mapOptions); (mapOptions as maplibregl.MapOptions).transformRequest = (url, resourceType) => { // this handles when a style is switched diff --git a/src/ui/autocomplete.ts b/src/ui/autocomplete.ts index 3d25cac9..79bf13b4 100644 --- a/src/ui/autocomplete.ts +++ b/src/ui/autocomplete.ts @@ -186,7 +186,7 @@ class AutocompleteUI { this.inputField.addEventListener('blur', this.close.bind(this), true); } - Logger.debug(`AutocompleteUI iniailized with options: ${JSON.stringify(this.config)}`); + Logger.debug('AutocompleteUI initialized with options', this.config); } public handleInput() { diff --git a/src/version.ts b/src/version.ts index 9faaae5f..5e827c33 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export default '4.4.5'; \ No newline at end of file +export default '4.4.6-beta.1'; \ No newline at end of file