Skip to content

Fix: Eliminate SimpleBlogPage paginator TypeError race condition - #16

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/mediawiki-2j4-paginator-race
Open

Fix: Eliminate SimpleBlogPage paginator TypeError race condition#16
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/mediawiki-2j4-paginator-race

Conversation

@sentry

@sentry sentry Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the TypeError: this.paginator.init is not a function error (MEDIAWIKI-2J4) which was caused by a race condition in the compatibility shim introduced in PR #11.

Root Cause:
The original fix attempted to patch OOJSPlus.ui.data.pagination.Paginator.prototype.init using an asynchronous mw.loader.using('ext.oOJSPlus.data').then(...) call. This created a race condition where SimpleBlogPage's XHR could resolve and call this.paginator.init() before the asynchronous promise resolved and the patch was applied, leading to the TypeError.

Solution:

  1. extension.json: Declared ext.oOJSPlus.data as a static dependency for the ext.wikioasismagic.simpleBlogPageFix module. This ensures that ext.oOJSPlus.data is fully loaded and available before the shim module's code begins execution.
  2. modules/ext.wikioasismagic.simpleBlogPageFix.js: Removed the mw.loader.using().then() wrapper. The prototype patch logic now executes synchronously at the top level of the module.

This change guarantees that the Paginator.prototype.init method is patched before SimpleBlogPage can attempt to call it, thereby eliminating the race condition and resolving the TypeError. The PHP hook that injects this module already ensures that SimpleBlogPage (and thus OOJSPlus) is loaded when the shim is active, making the static dependency declaration safe and appropriate.

Fixes MEDIAWIKI-2J4

This PR was automatically generated by Sentry. You can adjust this setting at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants