Handle the case when there are no nodes yet
Closed this issue · 6 comments
I'm in dynamic list and remove / add elements. Starting or update when the list is empty raise an error here https://github.com/callmecavs/bricks.js/blob/master/src/bricks.js#L103
Would be nice to handle this in bricks. My go around is to destroy bricks.js when going empty and restart it... but it's not very nice.
@JSteunou imo this is very specific to your use case. I think it's easier and cleaner for you to check if the container is empty on your end, rather than build this into the library
Like I said, my go around is to destroy on restart, not the easiest and cleanest way, I'm building a complete wrapper for this case, whereas it could be a simple if
well place in your lib.
trying to start Bricks when the container has no nodes, or removing all nodes then calling update, doesn't make much sense to me, especially given no context
in the context of a SPA, I can see the problem youre describing. I'd be happy to review a PR
Simple as that.
@JSteunou included in the latest release. thanks for the PR!
Nice, ty.