openedx / openedx/frontend-plugin-framework

Bug: Plugin configuration missing `priority` value will still render Plugin, but disrupts ordering

Open
#68 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13
Forks
28
PR merge metrics
No merged PRs in 30d

Description

In the example app, I noticed that if a PLUGIN_OPERATION.Insert was missing a priority value, then all of the plugins in the slot would still render, but they would not appear in the order defined in the env.config.js.

Example:

 pluginSlots: {
    slot_with_insert_operation: {
      keepDefault: true,
      plugins: [
        {
          op: PLUGIN_OPERATIONS.Insert,
          widget: {
            id: 'inserted_direct_plugin',
            type: DIRECT_PLUGIN,
            // PRIORITY VALUE IS REMOVED
            RenderWidget: PluginDirect,
          },
        },
        {
          op: PLUGIN_OPERATIONS.Insert,
          widget: {
            id: 'inserted_iframe_plugin',
            type: IFRAME_PLUGIN,
            priority: 30,
            url: 'http://localhost:8081/plugin_iframe',
            title: 'The iFrame plugin that is inserted in the slot',
          },
        },
      ],
    },
Screenshot 2024-05-24 at 10 22 44 AM

Suggested effect:
If the priority is missing from a plugin config, the plugin should either:

  1. Not be rendered, but then any other plugin operations that manipulate that Insert-ed plugin should be ignored/removed. In development, the logged error in the browser console will at least indicate that there's a misconfiguration.
  2. Should render, but be placed at the end of the plugin ordering. This will make it obvious during development that it isn't rendering as expected, but it doesn't make it clear why that is the case even with the logged error in the browser console.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the example app's env.config.js and reproduce the PLUGIN_OPERATIONS.Insert configuration with the priority removed. Trace the plugin ordering and the browser-console error, then inspect any related implementation or tests. Done means the missing-priority behavior is consistent, documented, and covered for the chosen handling of the affected plugin and subsequent operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.