Skip to content

[Bug] Remove dead AJAX import-progress code and unreachable settings partials #301

Description

@Ubayed-Bin-Sufian

Bug Description

admin/js/wpfaevent-admin.js contains an AJAX-based import-progress implementation, including wpfaevent_import_* AJAX handlers and progress-bar logic, that is not connected to the live Eventyay import flow and never executes in practice.

The AJAX code binds its submit handler to the form #wpfaevent-import-events-form. That form is only rendered by admin/partials/eventyay-import-settings.php, which belongs to Wpfaevent_Admin_Settings_Renderer. No current plugin code instantiates that renderer, so the partial is not rendered, the form does not appear on a live page, and the JavaScript handler never attaches to anything.

The live Eventyay import form is implemented separately in admin/class-wpfaevent-eventyay-importer.php. It submits synchronously to admin-post.php and does not use this AJAX implementation.

Steps to Reproduce

  1. Open the Eventyay import page in the WordPress admin.
  2. Inspect the form used for the current Eventyay import flow.
  3. Observe that the live form does not use the #wpfaevent-import-events-form ID expected by the AJAX handler.
  4. Trace Wpfaevent_Admin_Settings_Renderer and its eventyay-import-settings.php partial.
  5. Observe that there is no current plugin code instantiating the renderer, so the form targeted by the AJAX handler is never rendered.
  6. Adding the missing form ID to the live import form makes the AJAX path execute, but testing shows that its import steps run in a different order from the live POST-based flow.
  7. The AJAX path then produced fewer speakers and an empty schedule during testing.

Expected Behavior

The plugin should have a single, active Eventyay import flow without unused AJAX handlers, unreachable templates, or JavaScript that targets forms which are never rendered.

Removing the dead AJAX path should not change the behavior of the existing synchronous Eventyay import flow.

Actual Behavior

The repository contains an unused AJAX import-progress implementation and associated settings/update partials that are not connected to the current import flow.

Attempting to reconnect the AJAX implementation is also unsafe because its import sequence differs from the live POST-based flow. During testing, this resulted in fewer imported speakers and an empty schedule.

Because #277 hides empty schedule sections from the UI, this data loss may not be immediately visible to an administrator.

Screenshots

Not applicable. This issue concerns unreachable code and import-flow behavior rather than a visual UI defect.

Additional Context

This was identified while investigating #281 and PR #283.

The AJAX implementation should be removed rather than revived. Keeping an unreachable implementation creates unnecessary maintenance overhead, while reconnecting it without addressing its different import ordering can introduce data-loss behavior.

The cleanup should include:

  • wpfaevent_import_* AJAX handlers and their PHP callbacks
  • Associated progress-bar JavaScript in admin/js/wpfaevent-admin.js
  • admin/partials/eventyay-import-settings.php, after confirming it is unreachable
  • admin/partials/eventyay-update-events.php, after confirming it is unreachable
  • Wpfaevent_Admin_Settings_Renderer, if it has no remaining callers
  • Any enqueue, localization, nonce, or hook code used only by this dead path

The existing synchronous import flow in admin/class-wpfaevent-eventyay-importer.php and its admin-post.php submission should remain unchanged.

Contribution Checklist

  • I have searched existing issues to ensure this bug hasn't been reported
  • I have provided clear reproduction steps
  • I have included relevant environment details
  • I have described both expected and actual behavior

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions