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

Compatibility with Fastboot #74

Closed
pedrokost opened this issue Jun 5, 2016 · 9 comments
Closed

Compatibility with Fastboot #74

pedrokost opened this issue Jun 5, 2016 · 9 comments

Comments

@pedrokost
Copy link

Adding ember-leaflet to a Fastboot project is currently not possible.

$ ember fastboot
Installing FastBoot npm dependencies
document is not defined
ReferenceError: document is not defined
    at /home/pedro/Dropbox/Websites/zatresi/github-fastboot-example/dist/fastboot/vendor.js:75878:11
    at Sandbox.VMSandbox.eval (/home/pedro/Dropbox/Websites/zatresi/github-fastboot-example/node_modules/ember-cli-fastboot/node_modules/fastboot-express-middleware/node_modules/fastboot/lib/vm-sandbox.js:14:14)
[abbreviated]

I have made a small app (based on the fastboot quick start tutorial) which reproduces the problem.

A related issue was opened on ember-fastboot here: ember-fastboot/ember-cli-fastboot#74.

@miguelcobain
Copy link
Owner

Yes, we need to add guards to make sure we don't use leaflet on node.

@kirantpatil
Copy link

💯 👍

This enhancement is of top priority

@dbouwman
Copy link

dbouwman commented Oct 7, 2016

I just did a quick pass at fastboot-ifying the addon, and I have it working for a very simple demo case, but applied the pattern across the whole addon, so - in theory it should work.

To be clear - what I've done is simply changed the addon so it's basically ignored by fastboot / node. To be very very clear - it will not render a map on the server and send that down to a client.

This simply allows an app that is using this addon, to run using Fastboot, without errors.

I'll push to my fork tomorrow (after messing w/ it more) but if there are others who want to use this w/ FastBoot, please let me know here and participate in reviewing/testing the eventual PR.

What I'd like to add is a placeholder/loader so the DOM renders quickly, and the fact that there is a map "coming soon" is obvious to the viewer.

@miguelcobain
Copy link
Owner

@dbouwman Would love a PR. :)

I've also assumed that a first take would be to ignore any rendering on the server.
It looks like there are options for rendering leaflet maps on the server: https://github.com/jieter/leaflet-headless

I don't how feasible it would be to "hydrate" the map afterwards on the client. Sounds complex.

@miguelcobain
Copy link
Owner

Actually, that package provides an image. Ideal for that placeholder you mentioned.

@dbouwman
Copy link

dbouwman commented Oct 7, 2016

@miguelcobain exactly - although from my quick look at that repo, it sounds like the performance (~4s to render) is not quite inline with the intent of fastboot, so I'm not sure we'd want to bundle that into this addon. I'm still scheming on this, but perhaps another project that uses headless-leaflet, that can create those images and cache them, then in this project allow for a loadingImageUrl=http://url-to-the-cached-image.com/image.png sort of thing.

At least for the use-cases I'm looking at, that would be preferable.

PR for fastboot coming soon :)

@miguelcobain
Copy link
Owner

X-Ref: #104

@cesarizu
Copy link

I've posted a new PR at #110 that solves this problem.

@miguelcobain
Copy link
Owner

ember-leaflet is fastboot 1.0 compatible now

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

No branches or pull requests

5 participants