James Postadan | Oct2025-2 | Module Legacy Code | Sprint 1 | Hashtag slowing down my browser - #3
Open
japostadan wants to merge 3 commits into
Open
James Postadan | Oct2025-2 | Module Legacy Code | Sprint 1 | Hashtag slowing down my browser#3japostadan wants to merge 3 commits into
japostadan wants to merge 3 commits into
Conversation
The profile view wired the login handler to a click on a non-existent [data-action="proxy.php?url=https%3A%2F%2Fgithub.com%2Fjapostadan%2FModule-Legacy-Code%2Fpull%2Flogin"] element, so the login form rendered on a profile page had no submit handler. Submitting it triggered a native form POST to the static file server (501 on python http.server, 405 on nginx) instead of authenticating. - Wire the profile-page login form to its submit event, matching the home login view (lib uses handleLogin which preventDefaults). - Add a Playwright regression test: login -> view profile -> logout -> log back in from the profile page.
hashtagView called getBloomsByHashtag() without awaiting it. When the fetch resolved, state.updateState() dispatched a state-change event, which triggered handleRouteChange() → hashtagView() again → another fetch → infinite loop. destroy() on every iteration caused the visible blank flash. - Guard the fetch on state.currentHashtag so we only fetch when the hashtag actually changes; re-renders triggered by unrelated state-change events skip the fetch and just re-render from existing state. - Add Playwright regression tests: verifies exactly one fetch per navigation and that heading + blooms are visible and stable.
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
🧾 Changelist
views/hashtag.mjscalledapiService.getBloomsByHashtag()without awaiting it. When the fetch resolved,state.updateState()dispatched astate-changeevent synchronously, which triggeredhandleRouteChange()→hashtagView()again → another fetch → and so on forever.destroy()is called at the top of everyhashtagViewinvocation, so every iteration wiped the DOM blank before re-rendering — the blank flash visible to the user. Confirmed 53 fetches in 300ms in the red test.state.currentHashtag. If the state already reflects the requested tag (i.e. the view is re-rendering due to an unrelated state change), skip the fetch and re-render from existing state. One fetch per navigation; subsequent state-change-driven re-renders are read-only.tests/hashtag.spec.mjswith two Playwright regression tests — one that intercepts network calls and asserts exactly one fetch to/hashtag/**per navigation, and one that asserts heading and bloom content are visible and remain stable after settling. Red before the fix (53 fetches / blooms never appeared), green after. Full suite passes 16/16.❓ Questions
handleRouteChange— is noted but left out of scope. Should this be tracked as a separate issue, or is the current guard sufficient as a long-term solution?🙌 Notes for Reviewers
docker compose up -d, seed withdocker compose exec backend python populate.py, then click any hashtag link (e.g.#SwizBizon the timeline) — the page should load content cleanly with no flashing.