Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on wiki.js for story-startup and navigator #4200

Merged
merged 5 commits into from
Nov 2, 2020

Conversation

BurningTreeC
Copy link
Contributor

This removes the indirection through wiki.js to access addToStory and addToHistory in story.js

It's probably the first step to simplify the story-navigator mechanisms

@BurningTreeC
Copy link
Contributor Author

#4180

@Jermolene
Copy link
Member

I'm happy with this, but I think we should leave the existing methods on the wiki object for backwards compatibility.

@BurningTreeC BurningTreeC deleted the patch-31 branch July 20, 2020 06:33
@pmario
Copy link
Member

pmario commented Jul 20, 2020

Why did you close it? ... We can add a deprecated warning into the removed code, instead of removing it. Then after eg 2 versions we can remove it

@BurningTreeC BurningTreeC restored the patch-31 branch July 20, 2020 07:31
@BurningTreeC
Copy link
Contributor Author

@pmario - closed it because I thought this wouldn't be of interest

@BurningTreeC BurningTreeC reopened this Jul 20, 2020
@pmario
Copy link
Member

pmario commented Jul 20, 2020

I think the existing implementation is a bug, if you have 2 navigator widgets, that work for different stories. ... So imo it has to be fixed anyway.

I would add a console.log() to the "deprecated" code, instead of removing it, since Jeremy wants the function to be still part of the $tw.wiki API

eg: console.log("$tw.wiki.addToHistory() is deprecated! Use the this.story.addToHistory() from the story-object!") ... same with addToStory.

So if a developer uses the "old" function they should immediately see, that there is something wrong. .. BUT old plugins still work.

We could check our plugins and those of other important and core plugins, to see, if someone uses this function. ... But that's definitely much more work.

@pmario
Copy link
Member

pmario commented Jul 20, 2020

may be: console.log("$tw.wiki.addToHistory() is deprecated since V5.1.23! Use the this.story.addToHistory() from the story-object!")

@pmario
Copy link
Member

pmario commented Jul 20, 2020

I checked my plugins. 1 of them actually uses the "old" function. ... So Jeremy is right!

@BurningTreeC
Copy link
Contributor Author

@pmario @Jermolene - now the old code is still in place, I've put it back. Should I add a console log that marks them as deprecated?

@pmario
Copy link
Member

pmario commented Jul 28, 2020

... Should I add a console log that marks them as deprecated?

I think there should be a console.log()

@pmario
Copy link
Member

pmario commented Jul 28, 2020

@Jermolene ... needs to decide it.

@BurningTreeC
Copy link
Contributor Author

@Jermolene do you have any thoughts on this one?

@Jermolene
Copy link
Member

Hi @BurningTreeC @pmario we have a precedent in $:/core/modules/filters.js for displaying deprecation warnings to the console. But we should probably be smarter about it, and not re-display the same message more than once:

if(!errorHasBeenDisplayed) {
  errorHasBeenDisplayed = true;
  console.log("error");
}

@BurningTreeC
Copy link
Contributor Author

@Jermolene - I'd need advice where to put the console log and how to handle it it's already been displayed

@Jermolene
Copy link
Member

Hi @BurningTreeC for the moment we can just use console.log in the usual way; if there are issues with the amount of logging then we can address them later.

@BurningTreeC
Copy link
Contributor Author

Ok @Jermolene, I've added the console logs like @pmario suggested in a post above

@Jermolene
Copy link
Member

Thanks @BurningTreeC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants