Frederisk/Wikitext-VSCode-Extension

Error when pushing changes

jcdhan1 opened this issue · 2 comments

Replication steps

  1. Configure Wikitext-VSCode-Extension for any wiki on fandom.com
  2. Log in.
  3. Pull or create a page.
  4. Make an edit.
    image
  5. Push the edit.
    image
  6. Enter an edit summary (optional).
    image
  7. Hit the enter key:
    • Expected: Edit is successfully saved.
    • Actual: Edit is not saved and there is an error.
      image

Investigation

Since v3.6.3, this error happens when pushing to any fandom.com wiki:

'Invalid value for key "name". Expected type "" but got 0'

It doesn't happen when downgrading to v3.6.2.

The commit has been bisected to 1fecc62. The tag interface added in that commit mandates the property name of type string.

export interface Tag {
    name: string;
    defined?: string;
    active?: string;
}

Most of the objects in query.tags obey this.

But some of them have name be of type number.

{name: 0} // query.tags[4]
{name: 1} // query.tags[26]
{name: 2} // query.tags[27]
{name: 3} // query.tags[28]

The problem seems to be one of the transform methods in convertFunctions.ts. When the name has a numeric value, the object is not cast properly or at all.

Thanks for the detailed description of the issue, it was extremely helpful for me to solve it. I've tried to fix the issue, but I can't test it right away because my sysop permission on the publictestwiki have expired. Can you compile it yourself and report back the results?

Thanks for the detailed description of the issue, it was extremely helpful for me to solve it. I've tried to fix the issue, but I can't test it right away because my sysop permission on the publictestwiki have expired. Can you compile it yourself and report back the results?

Yeah, it works as expected now. I tested on two different Wikis.
image