Frederisk / Wikitext-VSCode-Extension

A Visual Studio Code Extension that provides language support for Wikitext.
MIT License
89 stars 14 forks source link

Error when pushing changes #57

Closed jcdhan1 closed 2 years ago

jcdhan1 commented 2 years ago

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 1fecc623986ed61ba5d85d217bce1d6f53cf1604. 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.

Frederisk commented 2 years ago

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?

jcdhan1 commented 2 years ago

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