Skip to content

馃摗 SSR Export - #46

Merged
demariadaniel merged 6 commits into
mainfrom
feat/ssr-setup
Aug 29, 2024
Merged

demariadaniel merged 6 commits into
mainfrom
feat/ssr-setup

Conversation

@demariadaniel

@demariadaniel demariadaniel commented Aug 27, 2024 •

Copy link
Copy Markdown
Contributor

Move dynamic 'iobio-charts' import into package
Export default as a function
Outcome of: overture-stack/stage#207

@demariadaniel demariadaniel changed the title WIP: SSR Export 馃摗 SSR Export Aug 28, 2024
@demariadaniel
demariadaniel marked this pull request as ready for review August 28, 2024 14:22
Comment on lines +38 to +40
const iobio = async () => {
await import('iobio-charts');
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great workaround! I'd truly like to figure out whether the IIFE example here would work for us

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IIFE pattern's been implemented so consumer app can simply do a standard import and the package handles the rest!

@justincorrigible justincorrigible left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 馃憦

Ideally, the IIFE that loads the library would be within the third party library so we could add a conditional check on our end meanwhile... but this works well enough for now.


// Init Iobio Charts
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import#import_a_module_for_its_side_effects_only
// Multiple Iobio Charts imports can trigger errors in related DOM APIs

@justincorrigible justincorrigible Aug 28, 2024 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// Multiple Iobio Charts imports can trigger errors in related DOM APIs
// Multiple Iobio Charts imports can trigger errors in related DOM APIs.
// This "lazy loading" prevents setups like NextJS from doing that, by importing only client-side.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

@demariadaniel
demariadaniel merged commit 6956316 into main Aug 29, 2024
@demariadaniel
demariadaniel deleted the feat/ssr-setup branch August 29, 2024 15:35
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