Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with Fastboot #230

Open
devotox opened this issue Oct 3, 2019 · 9 comments
Open

Usage with Fastboot #230

devotox opened this issue Oct 3, 2019 · 9 comments

Comments

@devotox
Copy link
Contributor

devotox commented Oct 3, 2019

I believe the initializers cause a problem with Fastboot as I get an error that
Error: Assertion failed: Your browser does not support IndexedDB!
because trying to be run in Node I believe

@tchak
Copy link
Member

tchak commented Oct 5, 2019

I think right now the most elegant solution would be to add a filter to your strategies dealing with indexed-source with a check for FastBoot (something like typeof FastBoot !== 'undefined'). Look for filter usage on this page https://orbitjs.com/v0.16/guide/coordination.html#Request-strategies

@tchak
Copy link
Member

tchak commented Oct 5, 2019

Kinda related: I would love to add a shoebox source to ember-orbit. https://ember-fastboot.com/docs/user-guide#the-shoebox

@devotox
Copy link
Contributor Author

devotox commented Oct 7, 2019

I did all that but the actual problem seems to be in the data-buckets not data-strategies

Error: Assertion failed: Your browser does not support IndexedDB!
    at assert (webpack://__ember_auto_import__/./node_modules/@orbit/core/dist/modules/es2017/assert.js?:8:11)
    at new IndexedDBBucket (webpack://__ember_auto_import__/./node_modules/@orbit/indexeddb-bucket/dist/modules/es2017/bucket.js?:29:5)
    at Object.create (/var/folders/zp/9skf2wx96b37hdk3_rbd457m0000gn/T/broccoli-5738uehfGk83Ui8q/out-1155-broccoli_merge_trees/assets/zenunu/data-buckets/main.js:12:1)

@tchak
Copy link
Member

tchak commented Oct 7, 2019

Yes, you should not use data-bucket in FastBoot you will want to disable it. You can do it in the bucket initializer – skip registration if in FastBoot.

@devotox
Copy link
Contributor Author

devotox commented Oct 7, 2019

So rather than add the typeof FastBoot check it may be better to write out a file to fastboot/initializers/<bucket-name>-bucket-initializer.js with an empty initialize function which should override the app initializer in a fastboot environment. Would you like this as a PR to create this with the blueprints you already have?

export function initialize() {
	// Override app bucket initializer in fastboot environment
}

export default {
	name: 'main-bucket-initializer',
	after: 'ember-orbit-config',
	initialize
};

@tchak
Copy link
Member

tchak commented Oct 7, 2019

There is no app initializer for bucket. Bucket initializer is generated by running ember g data-bucket main. We could (and should) improve initializers with FastBoot support but the topic probably need a bit of planing and discussion. What do you think @dgeb?

@tchak
Copy link
Member

tchak commented Oct 7, 2019

Oh, I think I see what you mean about overriding app initializer. Seems fine. Maybe add an option --fastboot for generators?

@devotox
Copy link
Contributor Author

devotox commented Oct 7, 2019

It could also just see if ember-cli-fastboot package is installed and add the extra files if and only if it is

@devotox
Copy link
Contributor Author

devotox commented Dec 22, 2019

What do you guys think about this?

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

No branches or pull requests

2 participants