Giter Site home page Giter Site logo

pragprog-book-tables's Introduction

Meow

This is the reference implementation of the demo project of the book Build Table Views with Phoenix LiveView.

You can find the starter version of the application to which we'll add the code step-by-step in pragprog-book-tables-starter-app.zip. It was created by the super kind @thebrianemory who went through the book backwards and removed all code that we added! Now, you can download that version and add the code from the book step-by-step yourself. Super great work, Brian! Thank you so much! β€οΈπŸ’›πŸ’™πŸ’šπŸ§‘

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

pragprog-book-tables's People

Contributors

pjullrich avatar

Stargazers

 avatar Chris Alley avatar Stefan Wasilewski avatar Heiko Goes avatar  avatar John Sucaet avatar Robert Wall avatar  avatar Huaisheng avatar Jimmy avatar Alexandre Moreira Xavier avatar Mark Sadegi avatar Kabeer Gharzai avatar Kyungyeol Kim (Bret) avatar Miha Filej avatar Carlo Gilmar avatar Shahryar Tavakkoli avatar Adolfo Neto avatar Sebastian Bachmann avatar ENKR | Jing Hui PANG | ε½­η«žθΎ‰ avatar Patrick Smith avatar Tony Stenberg avatar Pietro Loffredi avatar  avatar Gavin Henry avatar Jifffffy avatar  avatar David Viramontes avatar Taylor Dolezal avatar Hugo Frappier avatar Thorsten Deinert avatar Steve avatar Felipe Menegazzi avatar P Ξ D R O L U Z avatar Cristine Guadelupe avatar Stefan Hagen avatar Herminio Torres avatar

Watchers

Stefan Hagen avatar James Cloos avatar  avatar  avatar Steve avatar

pragprog-book-tables's Issues

mix.exs missing :inets dependency

Apparently newer versions of Elixir no longer come with the :http_util module. This is solved by adding :inets into the extra_applications as shown below:

# Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [
      mod: {Meow.Application, []},
      extra_applications: [:logger, :runtime_tools, :inets]
    ]
  end

This should be done with the mix.exs in the zipped up starter app as well.

Multiple window "scroll" events on the window may cause bugs

Hello!

Thanks for your book, I've bought it and I'm currently reading it πŸ‘πŸ» .

I would like to make a small comment about the infinite scrolling part. About 1 year ago, I implemented it a bit the same way you did and had an "hard-to-debug" issue.

The issue was more or less this: basically by using window.addEventListener directly inside the mounted function of the hook, there were cases where multiple identical events were attached to the window. So basically every time the user was using live navigation, it would add a new scroll event to the window. Something which is not really wanted.

The issue I had is that at some point, the JavaScript was pushing the event to a dead LiveView and causing the page to reload because multiple scroll events were bound on the window and one of them was triggered on a dead LiveView.

I fixed the issue by removing the scroll event using removeEventListener when the LiveView gets destroyed, something like that:

mounted() {
  // ...
  window.addEventListener("scroll", this.boundInfiniteScroll);
  // ...
},
destroyed() {
  // ...
  window.removeEventListener("scroll", this.boundInfiniteScroll);
  // ...
}

Note that the removeEventListener function needs a reference to the exact callback function that was added

Unexpected behaviour when filter and pagination live components interact

@PJUllrich thanks for this well written and informative book.

Issue

When a filter is applied to a paginated list the current page is not being reset - this sometimes causes the list to appear empty.

Reproduce

  • Go to page 2 of the meerkat list page.
  • Add a filter for meerkat name.
  • If there are not enough records to reach the second page the entire list will appear empty.

Solution?

Reset page to 1 in MeowWeb.MeerkatLive when new filter is detected

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.