ChatALL icon indicating copy to clipboard operation
ChatALL copied to clipboard

migrate ChatMessage to composition API SFC

Open k4lu-0p opened this issue 1 year ago • 2 comments

migrate ChatMessage to composition API SFC

k4lu-0p avatar May 18 '23 23:05 k4lu-0p

Thank you for contribution. However, the code contains many warnings like:

[Vue warn]: injection "Matomo" not found. 
  at <ChatMessage key=173 columns=2 message= {t
......

And errors when click hide button:

Uncaught TypeError: Cannot read properties of undefined (reading 'trackEvent')
    at hide (ChatMessage.vue:103:1)
    at eval (runtime-dom.esm-bundler.js:358:1)
    at callWithErrorHandling (runtime-core.esm-bundler.js:173:1)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:182:1)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:192:1)
    at HTMLButtonElement.invoker (runtime-dom.esm-bundler.js:345:1)

sunner avatar May 19 '23 00:05 sunner

Indeed, the problem comes from vue-matomo which loads asyncronously the script not making the intance and injection of Matomo available.

Edit: this PR#75 should be solve it

https://github.com/AmazingDreams/vue-matomo/blob/3e4c8000c9117beccff7a6712082de25dc13fca7/src/index.js#LL184C4-L184C4

k4lu-0p avatar May 19 '23 11:05 k4lu-0p

I looks that the commit was not rebased with the HEAD well?

sunner avatar May 19 '23 22:05 sunner

I have identified the source of the problem.

Your commit was not up to date with the upstream/main branch. You used git merge to combine the commits from upstream/main, but this altered the signatures of some commits. This would make the main commit history messy if I git merge your branch.

You should have used git rebase instead, which would preserve the commit history in a neat way.

Now, since your branch has diverged, neither git merge nor git rebase will work. I did some research and found a possible solution.

  1. Use git log and note down the hash values of the commits you made.
  2. Create a fresh branch based on the latest upstream main branch and switch to it.
  3. Use git cherry-pick HASH_OF_YOUR_COMMIT to apply your commits one by one. There may be conflicts. Follow the instructions from git cherry-pick to resolve them.
  4. If you have more than one commit and know how to amend, squash them into one commit.
  5. Make a new pull request based on the new branch.

It is a bit complicated, but it should work. Next time, always use git rebase to keep up with the upstream repo.

Thank you.

sunner avatar May 20 '23 13:05 sunner