Skip to content

chore: use static params when dynamic param metadata is missing #17836

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

Merged
merged 25 commits into from
May 16, 2025

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented May 14, 2025

Existing template versions do not have the metadata (modules + plan) in the db. So revert to using static parameter information from the original template import.

This data will still be served over the websocket.

TODO

Improve the error message when using static params.

@Emyrk Emyrk marked this pull request as ready for review May 15, 2025 02:10
@Emyrk Emyrk changed the title chore: static params as dynmaic chore: use static params when dynamic param metadata is missing May 15, 2025
@Emyrk
Copy link
Member Author

Emyrk commented May 15, 2025

@aslilac I took your suggestion and it is way cleaner 👍

handleDynamicParameters and handleStaticParameters are now their own functions with no returns.

The render function is still created, as I can reuse the websocket logic: handleParameterWebsocket

@Emyrk Emyrk requested a review from aslilac May 15, 2025 19:46
Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

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

closer! still some issues tho

})
}

func (api *API) handleParameterWebsocket(rw http.ResponseWriter, r *http.Request, render previewFunction) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func (api *API) handleParameterWebsocket(rw http.ResponseWriter, r *http.Request, render previewFunction) {
func (api *API) handleParameterWebsocket(rw http.ResponseWriter, r *http.Request, preview previewFunction) {

still think we should call it preview, especially since that's what you named the type

Copy link
Member Author

Choose a reason for hiding this comment

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

It will collide with the package name 😢

@Emyrk Emyrk force-pushed the stevenmasley/use_static_as_dynamic branch from 9f3529a to a6ce197 Compare May 15, 2025 23:48
@Emyrk Emyrk force-pushed the stevenmasley/use_static_as_dynamic branch from a6ce197 to df65b92 Compare May 15, 2025 23:50
@Emyrk Emyrk merged commit f36fb67 into main May 16, 2025
34 checks passed
@Emyrk Emyrk deleted the stevenmasley/use_static_as_dynamic branch May 16, 2025 16:48
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants