Trim comments to the non-obvious why
Drop narration, history and restated-code comments across the repo, keep short ones for security boundaries, upstream quirks and ordering constraints, and record the convention in CLAUDE.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
// The shared body of the admin "create X" forms (CreatePost, CreateFavorite,
|
||||
// CreateActivity, CreateBookmark): a ref per field, a GraphQL mutation taking a
|
||||
// single `input`, clear the fields on success, then emit "done" so the host
|
||||
// modal can close. A failure leaves the fields alone and its message on
|
||||
// `error` for the form to show — it used to go only to the console, so a
|
||||
// refused save looked exactly like a button that did nothing. `submitting`
|
||||
// disables the button while the request is out, and a second submit in that
|
||||
// window is ignored, so a double click cannot create the row twice.
|
||||
// Shared admin "create X" form logic. Errors land on `error`; double submits
|
||||
// are ignored while `submitting`.
|
||||
|
||||
import { ref } from "vue";
|
||||
import { gql } from "@/graphql";
|
||||
@@ -15,8 +9,7 @@ import { gql } from "@/graphql";
|
||||
* @param {string} options.mutation GraphQL mutation with one $input variable
|
||||
* @param {string[]} options.fields input field names, one text ref each
|
||||
* @param {(event: string) => void} options.emit the component's emit
|
||||
* @param {string[]} [options.optional] fields sent as undefined when blank,
|
||||
* so the backend sees "not set" rather than an empty string
|
||||
* @param {string[]} [options.optional] sent as undefined when blank
|
||||
* @param {string} [options.resultKey] mutation field to log on success
|
||||
* @returns {{
|
||||
* values: Record<string, import("vue").Ref<string>>,
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
// Rotate through a list on a timer, as the Listening and Steam widgets do.
|
||||
//
|
||||
// A self-rearming setTimeout rather than setInterval, so clicking to advance
|
||||
// manually restarts the full delay instead of leaving whatever was left of the
|
||||
// current tick. An optional periodic refresh callback covers the "re-poll the
|
||||
// source every few minutes" half of the same pattern. Both timers are cleared
|
||||
// on unmount.
|
||||
// Rotates a list on a re-armed timeout (so a manual advance restarts the
|
||||
// delay), with an optional periodic refresh.
|
||||
|
||||
import { ref, unref, onMounted, onUnmounted } from "vue";
|
||||
|
||||
|
||||
+1
-8
@@ -1,11 +1,4 @@
|
||||
/**
|
||||
* Small shared helpers. Used by components/elle/Elle.vue and views/home/Stamps.vue.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fisher-Yates shuffle. Mutates `array` in place and returns nothing —
|
||||
* callers must not do `arr = shuffleArray(arr)`.
|
||||
*/
|
||||
/** Shuffles in place and returns nothing. */
|
||||
export function shuffleArray(array) {
|
||||
for (var i = array.length - 1; i > 0; i--) {
|
||||
var j = Math.floor(Math.random() * (i + 1));
|
||||
|
||||
Reference in New Issue
Block a user