Skip to content

Using autoRefresh and render in the same Controller leads to white screen #2142

@liammcdermott

Description

@liammcdermott

In our IHP 1.3 project there's a Controller that uses autoRefresh to render a view until a particular field in the database changes. When that field changes it sends a redirectTo. This worked well for showing a spinner animation while waiting for something to happen, then redirecting the user after.

In IHP 1.4 (I also tried updating our project to the latest commit, too) this is no longer working. I have created an example IHP project so the issue is reproducible.

To reproduce:

  1. Start the IHP project and open it in a browser, as usual.
  2. Create a new Foo using the + New button.
  3. Click the Show link.
  4. In a second tab, open up the IHP IDE (if it isn't open already)
  5. Go to Datafoos and click the bar tickbox, so it's set to True

What I expect to happen: the user is sent to /Welcome.
What actually happens: the screen is white, and on the network tab of Developer Tools I see two empty responses from the websocket.

Note: clicking refresh in the browser makes IHP send the redirect correctly, so I surmise the issue is with autoRefresh.

Here're the problematic lines of code in context. For brevity:

    action ShowFooAction { fooId } = autoRefresh do
        foo <- fetch fooId
        if not foo.bar
        then render ShowView { .. }
        else redirectTo WelcomeAction

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions