perf: render standings directly from the model on the producing page#7655
Open
Rathoz wants to merge 2 commits into
Open
perf: render standings directly from the model on the producing page#7655Rathoz wants to merge 2 commits into
Rathoz wants to merge 2 commits into
Conversation
hjpalpha
approved these changes
Jun 12, 2026
hjpalpha
left a comment
Collaborator
There was a problem hiding this comment.
seems reasonable on phone
Collaborator
Does this only apply to the PR description or also the code itself? |
Collaborator
Author
|
Both, used it as a test scenario |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
d325db1 to
0f51ba5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes standings rendering on the producing page by building and rendering the StandingsModel directly from StandingsStorage.run() output, avoiding the stringify/parse round-trip through page variables while keeping the wiki-variable write path intact for cross-template consumers.
Changes:
StandingsStorage.runnow returns{ record, entries }, whererecordis tailored for direct model construction (notablymatchesas a Lua table andpagenamepopulated).StandingsTable.fromTemplateconsumes that return value to build a model viaStandings.standingsFromRecord(...)and renders viaStandingsDisplay{standings = model}.Widget/Standingsaccepts an optional prebuiltstandingsprop and skipsStandings.getStandingsTablewhen provided; adds a spec asserting direct-path render equals var-path render.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lua/wikis/commons/Widget/Standings.lua | Adds support for rendering from a prebuilt StandingsModel instead of loading via page vars/LPDB. |
| lua/wikis/commons/Standings/Table.lua | Producing-page render now uses the model returned by storage instead of re-reading via vars. |
| lua/wikis/commons/Standings/Storage.lua | Reuses a single storage record for saves and returns a model-ready record + entries. |
| lua/spec/standings_model_spec.lua | Adds an equality test ensuring direct-path rendering matches the existing var-path output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| local StringUtils = Lua.import('Module:StringUtils') | ||
|
|
||
| ---@param props {pageName: string, standingsIndex: integer?} | ||
| ---@param props {pageName: string?, standingsIndex: integer?, standings: StandingsModel?} |
Comment on lines
+21
to
+26
| local standings | ||
| if props.standings then | ||
| standings = props.standings | ||
| else | ||
| standings = Standings.getStandingsTable(props.pageName, props.standingsIndex) | ||
| end |
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.
Summary
StandingsStorage.runnow returns{record, entries}whererecordis a model-ready shallow copy of the storage record withmatchesrestored as a Lua table (not a JSON string), andpagenameset to the current page titleStandingsTable.fromTemplatecaptures the return value and callsStandings.standingsFromRecord(stored.record, stored.entries)to build the model directly, then rendersStandingsDisplay{standings = model}— eliminating the full stringify+parse round-trip through the wiki variable on the producing pageWidget/Standingsaccepts an alternativestandingsprop (a prebuiltStandingsModel); when present it skipsStandings.getStandingsTableentirely; the existingpageName/standingsIndexpath is untouchedsaveVars) is unchanged, so cross-template consumers (and later{{Standings}}transclusions on the same page) continue to work via the var path'direct-path render matches var-path render'builds a standings table, renders it both via the returned model and via the page-variable read, and asserts the two HTML strings are identicalHow did you test this change?
busted --run=ci: 606 successes / 0 failures / 0 errors (605 pre-existing + 1 new equality spec)luacheckon all modified files: 0 warnings / 0 errors🤖 Generated with Claude Code