bug report - javascript and buttons

I have been using prodigy a bit heavily lately and have about 1.8 bug reports:

#1: In 1.11.14, putting this line in $PRODIGY_HOME/prodigy.json would eliminate the "reject" button:

"buttons": ["accept", "ignore", "undo"],

In 1.14.7, it no longer seems to do that and I get all 4 buttons anyway. For my recipe, there is no functional difference between rejecting and ignoring, so it doesn't hurt me to have an extra button but it is confusing.

#2: This may just be an understanding issue on my side. In 1.14.7, when my custom recipe returns this object:

    "view_id": "blocks",
    "dataset": dataset,
    "stream": stream,
    "exclude": exclude,
    "update": make_update,
    "validate_answer": validate_answer,
    "config": {
        "lang": ner.lang,
        "labels": label,
        "relations_span_labels": span_label,
        "exclude_by": "input",
        "wrap_relations": wrap,
        "custom_theme": {"cardMaxWidth": "90%"},
        "hide_relation_arrow": hide_arrow_heads,
        "auto_count_stream": True,
        "blocks": [
            {"view_id": "relations"},
            {"view_id": "html"},
        "global_css": CSS,
        "javascript": JAVASCRIPT,

the JAVASCRIPT string is escaped and interpolated into a script block in the global scope as if it were a path like:

<script src="${escaped javascript}" async crossorigin> </script>

instead of being directly added to the global scope as the documentation indicates and the "Custom javascript" example on the same page shows. I haven't tested 1.14.4 to see whether the changes in 1.14.5 caused this or if it has always worked this way. Could just be a misinterpretation on my part about what the code in the example is doing.

1 Like

Hi @peter-axion, thanks for sharing your report on the forum.
As to #1: I'm not reproducing the issue with 1.14.7 (or later) with built-in recipes. Could there be something about your custom CSS that overrides the "buttons" config setting?

Wrt #2 what you're reporting is, indeed, a regression we introduced 1.14.5 and it was fixed in version 1.14.8.
Could you upgrade and see if your Javascript is loaded correctly?

Thanks again!

I confirmed that the config.javascript property does work as documented in v1.14.9.

For the buttons, I figured out what went wrong. I switched to an allowlist for .dockerignore and forgot to include prodigy.json. Not having the config will do it every time!

Thanks for the help and the new version!

1 Like