tinode / webapp

Tinode web chat using React
Apache License 2.0
324 stars 197 forks source link

When directly logging in and jumping to the user chat interface, the historical chat data will not be pulled. #124

Closed rudy-tao closed 1 year ago

rudy-tao commented 1 year ago

Describe the bug When directly logging in and jumping to the user chat interface, the historical chat data will not be pulled.

To Reproduce Steps to reproduce the behavior:

  1. Create a cred link on the server side. eg:http://localhost:6060/#cred/usrNPfP45f2imw?method=email&token=xxx&code=123456
  2. Directly log in and redirect to the user chat interface.

Expected behavior Display historical chat data.

rudy-tao commented 1 year ago

When backend automatically registers a user, it will generate a welcome message.

or-else commented 1 year ago

Fixed in https://github.com/tinode/webapp/commit/48405bcb945dcd5d6123671b8f62353c19ab9508. Please verify.

rudy-tao commented 1 year ago

This did not fix the issue, historical messages still do not appear when opening the page.

or-else commented 1 year ago

Please attach a client-side log. Thanks.

rudy-tao commented 1 year ago

image

rudy-tao commented 1 year ago

@or-else

or-else commented 1 year ago

See the line in the log "ver": "0.22.6"? That means you are not using the fix. Please test the fix I provided.

rudy-tao commented 1 year ago

image

rudy-tao commented 1 year ago

@or-else sorry, this is the log compiled and run using the next branch, and there are still no previous messages.

or-else commented 1 year ago

This should fix it: https://github.com/tinode/webapp/commit/5d56c1712846b3609e087bc6e06eb7fd91e763fc Thanks.

or-else commented 1 year ago

@rudy-tao Have you had a chance to test the fix?

rudy-tao commented 1 year ago

image

rudy-tao commented 1 year ago

@or-else I tried to run it, but there was no display of the chat history data.

rudy-tao commented 1 year ago

I also found a problem that when using automatic login redirect links on mobile with different resolutions, it does not follow the login process. I tried to debug the code and found that the SidepanelView in tinode-web.jsx was not rendering, which caused automatic login to fail.

rudy-tao commented 1 year ago

@rudy-tao Have you had a chance to test the fix?

I added the following judgment in version 0.22.6, which solved my problem.

if (this.state.isReader && !prevState.isReader){
      // If reader status has changed and data became available.
      // topic.getMeta(topic.startMetaQuery().withLaterData(MESSAGES_PAGE).build());
      this.subscribe(topic);
}
or-else commented 1 year ago

I also found a problem that when using automatic login redirect links on mobile with different resolutions, it does not follow the login process. I tried to debug the code and found that the SidepanelView in tinode-web.jsx was not rendering, which caused automatic login to fail.

I'm confused. Are you describing a different problem?

or-else commented 1 year ago

@rudy-tao Have you had a chance to test the fix?

I added the following judgment in version 0.22.6, which solved my problem.

if (this.state.isReader && !prevState.isReader){
      // If reader status has changed and data became available.
      // topic.getMeta(topic.startMetaQuery().withLaterData(MESSAGES_PAGE).build());
      this.subscribe(topic);
}

Where did you add it? If you added it here https://github.com/tinode/webapp/blob/next/src/views/messages-view.jsx#L268 then it will have unintended side effects.

or-else commented 1 year ago

I think I understand now why it's not working for you. You are trying to automatically subscribe user to a new P2P topic, one that he has not been subscribed to before. That's actually a feature. Let me make it optional.

or-else commented 1 year ago

I added this feature: https://github.com/tinode/webapp/commit/08bdc7bc08b54984b4acaf8aa981bab63667f2fe Change https://github.com/tinode/webapp/blob/08bdc7bc08b54984b4acaf8aa981bab63667f2fe/src/config.js#L128 to true and recompile. It should work.

rudy-tao commented 1 year ago

Still no history messages displayed...

rudy-tao commented 1 year ago

I added this feature: 08bdc7b Change

https://github.com/tinode/webapp/blob/08bdc7bc08b54984b4acaf8aa981bab63667f2fe/src/config.js#L128

to true and recompile. It should work.

image
or-else commented 1 year ago

It works now https://github.com/tinode/webapp/commit/3689b5d52794becf96049081b050cb1c23dce7e3.