-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refac js components #166
Refac js components #166
Conversation
3b162ae
to
5a49853
Compare
@brentyi , if you like it, can you please help me with the mypy error? My limited python knowledge is not enough to solve the issue :/ |
Need to find time to go through this in-depth, but looks good from a skim! Also happy to look into the mypy error... The main thing I'm uneasy about is the |
The rename is both for consistency and to make #161 easier. If we decide to use code generation for #161 then it wouldn’t matter much. For pure python typing this would help. However, I understand that introducing a breaking change may not be preferable for you. I can undo the name change if you want? |
Okay, let's switch it back. Reasoning: it seems unlikely we'll converge to a |
Why is value special? You can change other properties as well: visible, disables, etc., no? I was also thinking about the following use case: in future perhaps we want to enable property binding to make the app faster (bind a property to another component's property). |
5a49853
to
2d6802f
Compare
I undid the api change. |
2d6802f
to
6909002
Compare
But, initial_value->value is still done in messages! Is that ok? |
6909002
to
c7b0b0c
Compare
c7b0b0c
to
9e5a015
Compare
The difference I was alluding to is that everything in a For the internals and in messages, there are minor but important semantic differences between what it means when we write viser/src/viser/_gui_handles.py Lines 309 to 328 in abf6484
we re-send the original |
I understand the motivation. I still think doing partial updates (updating only changed properties) would have been safer and more principled way to do it. In the case where you set disabled/visible attributes from the client to server, they are not synchronised from server to client, right? Wouldn't it be better to treat all props the same? |
Yeah, I agree. I just didn't bother with the initial implementation because sending the full list of properties was much simpler to implement. Did you have an implementation in mind for doing a partial update? It seems like we could do one of:
I think the internal
That's correct, although I was never planning on adding mechanics to set these attributes from the client. If we added some kind of property binding like you mentioned this might become possible, although I'm skeptical the complexity tradeoff here. |
I think Which one would you prefer? |
Or perhaps we can have typeddict props ( |
Please let me know what you think now. |
(edit: now fixed) getting closer, need to fix some performance regressions in this branch: Screen.Recording.2024-02-06.at.1.59.12.AM.movon Screen.Recording.2024-02-06.at.2.00.31.AM.mov |
* Refac components * GUI api using partial update messages * Update message typecasting * Embrace untyped GuiUpdateMessage? * ruff * Address CI errors * Fix tab groups, spacing tweaks * Fix performance regression (components were unnecessarily re-rendering) * ruff * move multislider source --------- Co-authored-by: Brent Yi <[email protected]>
This PR implements the following:
The goal is gradually moving towards a unified API to add new components.
@brentyi - please let me know what you think.