Hey all!
I’m in the middle of developing a plugin that attempts to load pages that are wikilink’d as linked references.
I have a basic implementation working, but don’t like how the design looks currently and wanted to see if there were APIs that I’m missing that would help make this smoother.
Here’s my approach right now: discourse-wikilinks/wikilinks-init.js at main · dvargas92495/discourse-wikilinks · GitHub
Tl;dr:
- use
api.reopenWidget
on thepost-links
widget to override thehtml
method. - on the widget’s first render, fetch the topic title and then search topic that have [[title]] in its title
- After the fetch, schedule a rerender with the response data, using a flag to make sure we don’t infinitely fetch on the next render
This approach is suboptimal because:
- There’s a delay between the initial render and when the rest of the data renders.
- The flag preventing infinite fetching seems prone to error in the future
- I need to do to API calls, one for fetching the topic title (which should be available higher in the widget tree) and then one for the links.
- I have to copy and paste the original
html
widget method in my plugin’s code, which leaves it vulnerable to be forked
Any thoughts on how to mitigate these issues? Ideally I’d like edit the original loadTopicView
call to include the wikilinks.
Also does discourse or anyone in the community offer consulting calls? I’d love to pay for a call with an expert to give me a deep dive on all there is to know about how Discourse is architected and what plugins are available. I have already gone through most of the development docs and have jumped around the codebase a good bit.