Skip to content

Conversation

Gohlub
Copy link
Contributor

@Gohlub Gohlub commented Apr 22, 2025

Problem

Lack of UI template for App framework.

Solution

Implemented the template.

Docs Update

TODO
Corresponding docs PR

Notes

Tests not working.
{Any other information useful for reviewers.}

@Gohlub Gohlub changed the title Added template for UI, tests don't work still Added UI framework template Apr 22, 2025
Copy link
Member

@nick1udwig nick1udwig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments on #320 general review comment holds here

src/main.rs Outdated
"echo",
"fibonacci",
"file-transfer",
"framework-process"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change name here and throughout to hyperapp-<something>. As mentioned on #320, we're going to adopt a convention that hyperapp templates are prefixed by hyperapp-.

#[http]
async fn submit_entry(&mut self, value: String) -> Result<bool, String> {
self.state.insert(value.clone(), value);
Ok(true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted on #320, I think these are separated from the local/remote tagged functions in order to demonstrate you can do it. However, in this case, its not actually functional, and so is not demonstrating good practice. Ideally these would do something different than the local/remote functions so that the separation of functions is sane and not just for demonstration purposes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand what you mean by 'it's not functional'. FE requests are routed properly (i.e. you can submit an entry you define on the FE). Is this in reference to: https://discord.com/channels/1257731563374776341/1336772246089371678/1364667858801655878?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean submit_entry is the same as add_to_state and view_state is the same as get_state. The separation into a local/remote and separate http function is not functional. As opposed to, say, a case where a local/remote function did thing A whereas http function did thing B

"http-server:distro:sys",
"http-client:distro:sys",
"vfs:distro:sys",
"homepage:homepage:sys"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort, as on #320

@@ -0,0 +1,69 @@
use hyperprocess_macro::hyperprocess;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer grouping args like

stdlib

imported in Cargo.toml

and possibly a third group of "written by us"

with each group alphabetized.

So here should either be:

use std::collections::HashMap;

use hyperprocess_macro::hyperprocess;
use serde::{Deserialize, Serialize};

or

use std::collections::HashMap;

use serde::{Deserialize, Serialize};

use hyperprocess_macro::hyperprocess;

thiserror = "1.0"
url = "2.5.3"
rand = "0.8"
wit-bindgen = "0.36.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of unused deps (I suspect at least bincode, rand, rmp-serde, thiserror, url are unused) & sort remaining deps alphabetically


// Local Hyperware request
#[local]
async fn add_to_state(&mut self, value: String) -> Result<bool, String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix the caller-utils/wit-generator parsing so we can have a () here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean an function with no argument?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean it should return Result<(), String>

@Gohlub Gohlub force-pushed the feat/app-framework-template-ui branch from 07eb003 to 2bc2260 Compare April 29, 2025 14:06
Base automatically changed from develop to master August 5, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants