Skip to content

Commit

Permalink
Fix issue with misplaced condition (#436)
Browse files Browse the repository at this point in the history
fix(web-transport): fix issue with misplaced condition

Fix issue because of which APM fix worked only when the client has been configured with 
`logVerbosity: true`.
  • Loading branch information
parfeon authored Feb 10, 2025
1 parent 07b3418 commit 2a0535c
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 14 deletions.
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
changelog:
- date: 2025-02-10
version: v8.8.1
changes:
- type: bug
text: "Fix issue because of which APM fix worked only when the client has been configured with `logVerbosity: true`."
- date: 2025-02-05
version: v8.8.0
changes:
Expand Down Expand Up @@ -1132,7 +1137,7 @@ supported-platforms:
- 'Ubuntu 14.04 and up'
- 'Windows 7 and up'
version: 'Pubnub Javascript for Node'
version: '8.8.0'
version: '8.8.1'
sdks:
- full-name: PubNub Javascript SDK
short-name: Javascript
Expand All @@ -1148,7 +1153,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.8.0.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.8.1.zip
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down Expand Up @@ -1819,7 +1824,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v8.8.0/pubnub.8.8.0.js
location: https://github.com/pubnub/javascript/releases/download/v8.8.1/pubnub.8.8.1.js
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v8.8.1
February 10 2025

#### Fixed
- Fix issue because of which APM fix worked only when the client has been configured with `logVerbosity: true`.

## v8.8.0
February 05 2025

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
npm install pubnub
```
* or download one of our builds from our CDN:
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.8.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.8.0.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.8.1.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.8.1.min.js
2. Configure your keys:
Expand Down
8 changes: 5 additions & 3 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -3732,7 +3732,7 @@
return base.PubNubFile;
},
get version() {
return '8.8.0';
return '8.8.1';
},
getVersion() {
return this.version;
Expand Down Expand Up @@ -4202,9 +4202,11 @@
// Keeping reference on current `window.fetch` function.
WebTransport.originalFetch = fetch.bind(window);
// Check whether `fetch` has been monkey patched or not.
if (logVerbosity && this.isFetchMonkeyPatched()) {
console.warn("[PubNub] Native Web Fetch API 'fetch' function monkey patched.");
if (this.isFetchMonkeyPatched()) {
WebTransport.originalFetch = WebTransport.getOriginalFetch();
if (!logVerbosity)
return;
console.warn("[PubNub] Native Web Fetch API 'fetch' function monkey patched.");
if (!this.isFetchMonkeyPatched(WebTransport.originalFetch))
console.info("[PubNub] Use native Web Fetch API 'fetch' implementation from iframe as APM workaround.");
else
Expand Down
2 changes: 1 addition & 1 deletion dist/web/pubnub.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/core/components/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
return base.PubNubFile;
},
get version() {
return '8.8.0';
return '8.8.1';
},
getVersion() {
return this.version;
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": "pubnub",
"version": "8.8.0",
"version": "8.8.1",
"author": "PubNub <[email protected]>",
"description": "Publish & Subscribe Real-time Messaging with PubNub",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const makeConfiguration = (
return base.PubNubFile;
},
get version(): string {
return '8.8.0';
return '8.8.1';
},
getVersion(): string {
return this.version;
Expand Down
7 changes: 5 additions & 2 deletions src/transport/web-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ export class WebTransport implements Transport {
WebTransport.originalFetch = fetch.bind(window);

// Check whether `fetch` has been monkey patched or not.
if (logVerbosity && this.isFetchMonkeyPatched()) {
console.warn("[PubNub] Native Web Fetch API 'fetch' function monkey patched.");
if (this.isFetchMonkeyPatched()) {
WebTransport.originalFetch = WebTransport.getOriginalFetch();

if (!logVerbosity) return;

console.warn("[PubNub] Native Web Fetch API 'fetch' function monkey patched.");

if (!this.isFetchMonkeyPatched(WebTransport.originalFetch))
console.info("[PubNub] Use native Web Fetch API 'fetch' implementation from iframe as APM workaround.");
else
Expand Down

0 comments on commit 2a0535c

Please sign in to comment.