derek-zhou

derek-zhou

To add to the nil issue: I can have a nil as the default value for :map, but not as a new nil in runtime assignment. So it does not actually eliminate the need of the nil checks in templates. Also unlike [], an empty map %{} is hard to be used as a default value because the way map matching work.

0
Post #213
bartblast

bartblast

Creator of Hologram

Another option is to use context API to avoid property drilling or make some of the subcomponents stateful and manage their own state (instead of passing the data downstream from parent components).

0
Post #214
msaraiva

msaraiva OP

Broadway Core Team

Surface v0.8 has been released!

For details on what’s new, take a look at our new blog post.

Along with this new release, we’re also activating our Twitter account so if you want to keep updated with the latest news on Surface, follow @SurfaceUI.

Some v0.8 highlights:

  • Scoped CSS - When defining a component or LiveView, you can now declare its CSS styles directly in the template using <style> or in a colocated .css file. The Surface compiler will treat those styles as scoped styles so any CSS declaration will apply only to the related component.
  • New context API - The context API has been extended and fully redesigned to improve ergonomics and make it more friendly for diff tracking. The compiler is able now to detect many cases where the use of contexts might impact performance and suggest one or more alternative approaches to achieve the same goal.
  • render_sface/1 function - One limitation of using colocated .sface files was that there was no easy way to override render/1 to (re)calculate assigns values to be used in the template. With render_sface/1 you can now safely implement render/1, do your calculation and keep the external file.
  • –tailwind and –layouts options for mix surface.init.
  • catalogue_test/1 macro - One common issue when using the Surface Catalogue is that your examples and playgrounds might get easily out-of-sync with the related component due to continuous changes in its API. With the new catalogue_test macro, you can now generate basic tests for all your examples and playgrounds with ease, minimizing the chances of facing this kind of issue.
  • Enhanced catalogue example API - We improved the Catalogue’s API by adding a new module called Surface.Catalogue.Examples, which allows users to create multiple examples as function components per module.

Full changelog can be found here.

A migration guide is also provided with more information about running mix surface.convert to help you migrate your code from v0.7 to v0.8.

Happy coding!

-marlus

18
Post #215
CharlesIrvine

CharlesIrvine

I have been experimenting with LiveView for a while now, but I just discovered Surface. Really phenomenal work!! I am blown away. Thanks!!! It seems like it should be pulled into LiveView wholesale.

1
Post #216
— All posts loaded —