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

Discussion cache issue #267

Closed
literakl opened this issue Jan 6, 2022 · 4 comments
Closed

Discussion cache issue #267

literakl opened this issue Jan 6, 2022 · 4 comments
Assignees
Labels
priority: P1 must be fixed first type: bug Something isn't working
Milestone

Comments

@literakl
Copy link
Owner

literakl commented Jan 6, 2022

Open some article with comments, go back and open another article very fast - you can see the comments from the first article. Reproduced on phone.

@literakl literakl added type: bug Something isn't working priority: P1 must be fixed first labels Jan 6, 2022
@literakl literakl self-assigned this Jan 6, 2022
literakl added a commit that referenced this issue Jan 12, 2022
add itemId to track if passed parameters have expected values
no cache - it must work reliably first

Current state - previous discussion comments displays often during browsing between blogs
@literakl
Copy link
Owner Author

Ideal resolution:

Use case A

  • user starts at home
  • user opens a blog X
  • blog X and its comments are fetched from REST
  • blog X with its comments is displayed
  • user open a link to author profile
  • user click back in browser
  • blog X and its comments are used from Vuex because X = X
  • blog X with its comments is displayed again, no error is shown, comments are not duplicated

Use case B

  • user starts at home
  • user opens blog X
  • blog X and its comments are fetched from REST
  • blog X with its comments is displayed
  • user open a link in blog X to another blog Y
  • we must clear Vuex immediately because X <> Y
  • blog Y and its comments are fetched from REST
  • blog Y with its comments is displayed
  • user click back in browser
  • we must clear Vuex immediately because X <> Y
  • blog X and its comments are fetched from REST
  • blog X with comments is displayed correctly

Use case C

  • user starts at home
  • user opens blog X
  • blog X and its comments are fetched from REST
  • blog X with comments is displayed correctly
  • user click back in browser and click article Z immediately
  • we must clear Vuex immediately because X <> Z
  • article Z and its comments are fetched from REST
  • article Z with its comments is displayed

@literakl
Copy link
Owner Author

Trouble is caused because Comments.vue receives wrong itemId on initialization which is reactively updated later. There were workarounds which caused the discussion was reloaded twice but it worked in most cases. When I removed them wrong discussions are displayed.

Navigated to http://localhost:8080/
09:07:19.218 log.js:24 [HMR] Waiting for update signal from WDS...
09:07:19.488 polls.js:82 GET_LATEST_POLL
09:07:19.508 items.js:169 GET_ITEM_STREAM
09:07:19.692 items.js:169 GET_ITEM_STREAM
09:07:20.491 backend.js:2237 vue-devtools Detected Vue v2.6.14
09:07:23.574 Blog.vue:159 Blog created
09:07:23.575 items.js:105 FETCH_CONTENT mate-kompletni-lekarnicku-dle-predpisu
09:07:23.592 Blog.vue:163 Blog mounted
09:07:23.610 items.js:122 Fetched, itemId=1fnr5of6ok
09:07:23.611 Blog.vue:104 Blog.vue watch 1fnr5of6ok
09:07:23.623 Comments.vue:94 Comments created itemId=1fnr5of6ok
09:07:23.623 comments.js:108 FETCH_COMMENTS 1fnr5of6ok
09:07:23.656 Comments.vue:79 Comments mounted
09:07:23.656 Blog.vue:147 Blog updated
09:07:23.696 Comments.vue:64 Comments watch comments
09:07:23.715 Comments.vue:82 Comments updated
09:07:26.315 polls.js:82 GET_LATEST_POLL
09:07:26.336 Comments.vue:98 Comments destroyed
09:07:26.338 comments.js:36 DESTROY_COMMENTS
09:07:26.341 items.js:169 GET_ITEM_STREAM
09:07:26.351 Blog.vue:173 Blog onpopstate
09:07:26.415 items.js:169 GET_ITEM_STREAM
09:07:27.518 Blog.vue:159 Blog created
09:07:27.518 items.js:105 FETCH_CONTENT video-sileneho-ridice-kamionu-predjizdejiciho-v-krizovatce
09:07:27.528 Comments.vue:94 Comments created itemId=1fnr5of6ok
09:07:27.529 comments.js:108 FETCH_COMMENTS 1fnr5of6ok
09:07:27.559 Comments.vue:79 Comments mounted
09:07:27.560 Blog.vue:163 Blog mounted
09:07:27.571 items.js:122 Fetched, itemId=1fnr5oevlb
09:07:27.572 Blog.vue:104 Blog.vue watch 1fnr5oevlb
09:07:27.576 Comments.vue:74 Comments watch itemId 1fnr5oevlb
09:07:27.576 Comments.vue:82 Comments updated
09:07:27.576 Blog.vue:147 Blog updated
09:07:27.613 Comments.vue:64 Comments watch comments
09:07:27.632 Comments.vue:82 Comments updated

@literakl
Copy link
Owner Author

When I replaced infinitegrid with list of items, it still did not work. Maybe it was even worse.

@literakl literakl added this to the V220109 milestone Jan 15, 2022
@literakl
Copy link
Owner Author

Caching not neccessary, there is no traffic now

literakl added a commit that referenced this issue Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: P1 must be fixed first type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant