Skip to content

Liveview example doesn't update view on click, but eats memory until OOMΒ #397

@DestyNova

Description

@DestyNova

Describe the bug πŸ›
The liveview counter example from the Happyx website doesn't update the view when the button is clicked, but instead starts using more and more memory until OOM happens.

To Reproduce πŸ‘¨β€πŸ”¬
Steps to reproduce the behavior:

  1. Build the example program:
import happyx

var counter = remember 0

liveview:
  "/":
    {counter}
    tButton:
      "click me!"
      @click:
        counter += 1

serve "127.0.0.1", 5000:
  discard
  1. Run the program and load it in Chromium (doesn't work at all in Firefox, says it can't connect to the websocket)
  2. Click on the "click me!" button
  3. Observe lack of update
  4. Open htop and notice climbing memory and CPU usage in the server process
  5. Refresh the browser and note that the state was updated (but only for the first click after each refresh; subsequent clicks send the same message that seems to have no effect, until reloading). Looking in the inspector, no response is ever received from the websocket.
  6. Kill the process before it eats the universe

Expected behavior πŸ€”

  1. Clicking should visibly update without needing to refresh the page (i.e. we should get a response from the websocket)
  2. The process shouldn't leak memory and go bananas

Please complete the following information πŸ“ƒ

  • OS: Linux
  • OS Version 6.9.3, x86_64
  • HappyX version 4.7.4
  • HappyX project type: liveview (it seems ssr must be selected if creating the project with hqx, but it's the same without hqx)
  • HappyX project language: nim
  • Nim/Python version: 2.2.2
  • HTTP Server: default (httpbeast?)
  • Browser: Chromium
  • Browser Version: 132.0.6834.83

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions