Open devotox opened 5 years ago
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
Kinda related: I would love to add a shoebox source to ember-orbit. https://ember-fastboot.com/docs/user-guide#the-shoebox
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)
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
.
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
};
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?
Oh, I think I see what you mean about overriding app initializer. Seems fine. Maybe add an option --fastboot
for generators?
It could also just see if ember-cli-fastboot
package is installed and add the extra files if and only if it is
What do you guys think about this?
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