Skip to content

Conversation

@TomStrepsil
Copy link
Contributor

@TomStrepsil TomStrepsil commented Jul 6, 2025

Issue

resolves #39
resolves #57

Details

  • Modify the "features" package to used named exports; independent bundles per features store factory, thus ensuring the "ssr" package is not a dependency of the single export, effectively rendering it a fixed requirement at build time (despite tree shaking removing if not used)
  • Should also allow react "server components" to import feature stores that don't rely on React context, which it otherwise complains about having spotted an import in the bundle:

Error: × You're importing a component that needs `createContext`. This React hook only works in a client component. To fix, mark the file (or its parent) with the `"use client"` directive.

Scout Rule

  • rename isClient to isBrowser in the build setup & package.json script input, to better describe the intended audience of the browser bundles
  • change the order/nature of the exports on all packages to better support typescript module resolution

all examples

  • moved to import typescript types explicitly (as type) after unexpected pipeline failure

ssr package

  • support de-structuring of the output from the serialisation factory

Upgrade guide

  • imports of
import { ssrBackedReactContextFeaturesStoreFactory as featuresStoreFactory } from "@asos/web-toggle-point-features";

...should become:

import featuresStoreFactory from "@asos/web-toggle-point-features/storeFactories/ssrBackedReactContextFeaturesStoreFactory";

...with the same format applying to globalFeaturesStoreFactory, reactContextFeaturesStoreFactory and nodeRequestScopedFeaturesStoreFactory

CheckList

  • PR starts with [ISSUE_ID].
  • Has been tested (where required) before merge to main.

TomStrepsil and others added 8 commits December 24, 2024 17:31
* rename to proper module namespace

* update docs links

* update versions

* web toggle point in readme title

* fixup changelog from revised 0.x range

* 2.0.0 -> 0.5.0 in oss version scheme

* fix broken link syntax in CHANGELOG

* consistent quoting

* more version history issues

* fixup module name in jsdoc

* add web
remove sdkInstanceProvider

* remove SDKInstanceProvider

* fixup jsdoc dedupe

* tweak

* clarity re: ssr package

* casing etc
* update workflows

* version

* typo

* update chromium linux snaps

* versions for serve update

* package.json repository field

* update root package.lock

* bugs & directories/doc fields

* fix changelog

---------

Co-authored-by: Tom Pereira <tom.pereira@johnlewis.co.uk>
Co-authored-by: Tom Pereira <tom.pereira@johnlewis.co.uk>
@TomStrepsil TomStrepsil changed the title [39] move features package to named exports [39] Move features package to named exports Jul 6, 2025
@TomStrepsil TomStrepsil changed the title [39] Move features package to named exports [39] Move features package to named exports, preventing "ssr" package dependency Jul 6, 2025
@TomStrepsil TomStrepsil requested a review from a team as a code owner July 15, 2025 18:36
@TomStrepsil TomStrepsil changed the title [39] Move features package to named exports, preventing "ssr" package dependency [39] [57] Move features package to named exports, preventing "ssr" package dependency Aug 21, 2025
@TomStrepsil TomStrepsil changed the title [39] [57] Move features package to named exports, preventing "ssr" package dependency [39] [57] Move features package to named exports, preventing "ssr" package dependency. FireFox compatibility. Aug 22, 2025
@TomStrepsil TomStrepsil changed the title [39] [57] Move features package to named exports, preventing "ssr" package dependency. FireFox compatibility. [39] [57] Move features package to named exports, preventing "ssr" package dependency. Firefox compatibility. Aug 22, 2025
TomStrepsil added a commit to TomStrepsil/web-toggle-point that referenced this pull request Sep 26, 2025
@asos-dominicjomaa asos-dominicjomaa merged commit 2918c6b into ASOS:main Sep 29, 2025
10 checks passed
@TomStrepsil TomStrepsil deleted the bug/39-move-features-package-to-named-exports branch September 29, 2025 08:53
@TomStrepsil
Copy link
Contributor Author

N.B. For posterity, I believe the change in the Windows Emoji that caused a pipeline failure and resulted in a new image being uploaded here was due to this:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants