Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
OPTIMIZER_URIconstant is exported and all-caps; consider using an unexported, Go-styleoptimizerURI(or similar) unless it’s intentionally part of the public API. - Since the optimizer is now always enabled with a default URL, consider whether the on/off behavior should be controlled explicitly (e.g., by a config flag) rather than implicitly via the environment variable.
- You might want to read and cache the optimizer base URI once (e.g., at site initialization) instead of calling
os.Getenvon everyoptimizerUpdateto avoid repeated environment lookups in a potentially hot path.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `OPTIMIZER_URI` constant is exported and all-caps; consider using an unexported, Go-style `optimizerURI` (or similar) unless it’s intentionally part of the public API.
- Since the optimizer is now always enabled with a default URL, consider whether the on/off behavior should be controlled explicitly (e.g., by a config flag) rather than implicitly via the environment variable.
- You might want to read and cache the optimizer base URI once (e.g., at site initialization) instead of calling `os.Getenv` on every `optimizerUpdate` to avoid repeated environment lookups in a potentially hot path.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Member
|
We should do this as an opt-in, since we're transmitting usage data here. I'd introduce a dedicated optimizer toggle in the experimental dialog and also add a documentation page explaining the optimizer concept, its goals and its current state. |
Contributor
|
I wonder if "cloud-based" is the right terminology. At least not for people who run their local instance. |
Member
Good point. Updated the text to be more concrete and use "external service" terminology. (updated screenshot) |
andig
commented
Mar 21, 2026
andig
commented
Mar 21, 2026
andig
commented
Mar 21, 2026
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
OPTIMIZER_URIconstant incore/site_optimizer.gois exported but only used internally; consider making it unexported and following Go naming conventions (e.g.optimizerURI) to avoid polluting the public API surface. - You now have three helpers around optimizer/experimental state (
optimizerEnabled,isOptimizer,isExperimental); consider consolidating them or reusingoptimizerEnabledwhere appropriate to avoid diverging logic between CLI and runtime behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `OPTIMIZER_URI` constant in `core/site_optimizer.go` is exported but only used internally; consider making it unexported and following Go naming conventions (e.g. `optimizerURI`) to avoid polluting the public API surface.
- You now have three helpers around optimizer/experimental state (`optimizerEnabled`, `isOptimizer`, `isExperimental`); consider consolidating them or reusing `optimizerEnabled` where appropriate to avoid diverging logic between CLI and runtime behavior.
## Individual Comments
### Comment 1
<location path="assets/js/components/Config/OptimizerModal.vue" line_range="56-65" />
<code_context>
+ },
+ },
+ methods: {
+ async change(e: Event) {
+ try {
+ this.error = null;
+ await api.post(`config/optimizer/${(e.target as HTMLInputElement).checked}`);
+ } catch (err) {
+ const e = err as AxiosError<{ error: string }>;
+ this.error = e.response?.data?.error || e.message;
+ }
</code_context>
<issue_to_address>
**suggestion:** Avoid reusing the name `e` for both the event parameter and the error object in `change`.
Inside `change`, `e` is used both as the `Event` parameter and then redefined in the `catch` block. Even though the scopes don’t conflict, this hurts readability and can cause confusion during future changes. Consider using clearer names, e.g. `event` for the parameter and `error`/`axiosError` in the `catch` block.
```suggestion
methods: {
async change(event: Event) {
try {
this.error = null;
await api.post(`config/optimizer/${(event.target as HTMLInputElement).checked}`);
} catch (err) {
const axiosError = err as AxiosError<{ error: string }>;
this.error = axiosError.response?.data?.error || axiosError.message;
}
},
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add ability to enable optimizer via UI.
Screenshots
Todos
Future
Add more status info like last update, server fails, ... to the optimizer tile.