Skip to content

chore: more size reduction#1399

Merged
fadi-george merged 6 commits intomainfrom
fg/size-reduction-3
Oct 17, 2025
Merged

chore: more size reduction#1399
fadi-george merged 6 commits intomainfrom
fg/size-reduction-3

Conversation

@fadi-george
Copy link
Copy Markdown
Contributor

@fadi-george fadi-george commented Oct 15, 2025

Description

1 Line Summary

  • more size reduction

Details

  • more underscore prefixing renaming
  • also break up subscription helper
// old
  build/releases/OneSignalSDK.page.js
  Size limit: 420 B
  Size:       420 B gzipped
  
  build/releases/OneSignalSDK.page.es6.js
  Size limit: 47.88 kB
  Size:       47.88 kB gzipped
  
  build/releases/OneSignalSDK.sw.js
  Size limit: 13.62 kB
  Size:       13.62 kB gzipped
  
  build/releases/OneSignalSDK.page.styles.css
  Size limit: 8.81 kB
  Size:       8.8 kB  gzipped

// new
  build/releases/OneSignalSDK.page.js
  Size limit: 420 B
  Size:       420 B gzipped
  
  build/releases/OneSignalSDK.page.es6.js
  Size limit: 47.59 kB
  Size:       47.59 kB gzipped
  
  build/releases/OneSignalSDK.sw.js
  Size limit: 13.62 kB
  Size:       13.62 kB gzipped
  
  build/releases/OneSignalSDK.page.styles.css
  Size limit: 8.81 kB
  Size:       8.8 kB  gzipped

Systems Affected

  • WebSDK
  • Backend
  • Dashboard

Validation

Tests

Info

Checklist

  • All the automated tests pass or I explained why that is not possible
  • I have personally tested this on my machine or explained why that is not possible
  • I have included test coverage for these changes or explained why they are not needed

Programming Checklist
Interfaces:

  • Don't use default export
  • New interfaces are in model files

Functions:

  • Don't use default export
  • All function signatures have return types
  • Helpers should not access any data but rather be given the data to operate on.

Typescript:

  • No Typescript warnings
  • Avoid silencing null/undefined warnings with the exclamation point

Other:

  • Iteration: refrain from using elem of array syntax. Prefer forEach or use map
  • Avoid using global OneSignal accessor for context if possible. Instead, we can pass it to function/constructor so that we don't call OneSignal.context

Screenshots

Info

Checklist

  • I have included screenshots/recordings of the intended results or explained why they are not needed

Related Tickets



This change is Reviewable


@fadi-george fadi-george changed the base branch from fg/size-reduction to fg/size-reduction-2 October 15, 2025 18:21
@fadi-george fadi-george changed the title More Web SDK Size Reduction chore: more size reduction Oct 15, 2025
Copy link
Copy Markdown
Contributor

@sherwinski sherwinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: consider pulling the macro into a task in package.json that can be run with the linter and formatter

const propertyKey = operation.property;
const allowedKeys = Object.keys(properties);
if (allowedKeys.includes(propertyKey)) {
return new PropertiesObject({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe this can be compressed into

Suggested change
return new PropertiesObject({
return new PropertiesObject(
allowedKeys.includes(propertyKey)
? { ...properties, [propertyKey]: operation.value }
: { ...properties }
);

Base automatically changed from fg/size-reduction-2 to main October 17, 2025 16:37
@fadi-george
Copy link
Copy Markdown
Contributor Author

return new PropertiesObject

@sherwinski not all renames will be beneficial since gzip fill find common patterns to reuse so some cases a prefix rename will increase the size.

@fadi-george fadi-george merged commit 1e7ddbd into main Oct 17, 2025
3 checks passed
@fadi-george fadi-george deleted the fg/size-reduction-3 branch October 17, 2025 17:05
@github-actions github-actions Bot mentioned this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants