Skip to content

Conversation

@lotrien
Copy link
Member

@lotrien lotrien commented Jan 19, 2021

  • removed redundant Redux store with huge amount of boilerplate in favor of local state with Recoil;
  • optimized pagination request handling with Recoil (it caches prev results and doesn't make additional request for the same markers);
  • optimized /:snippetId route by checking cached snippet by id and if it's not there -> make request

@lotrien lotrien self-assigned this Jan 19, 2021
@lotrien lotrien changed the title [State Management] Remove Redux [State Management] reconsider state management Jan 19, 2021
Snizhana
Snizhana previously approved these changes Jan 19, 2021
Copy link
Contributor

@Snizhana Snizhana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, it is so nice to see 800 lines of removed code 😊

package.json Outdated
},
"scripts": {
"lint": "eslint --ignore-path .gitignore --ext js,jsx .",
"lint": "eslint --ignore-path .gitignore --ext js,jsx,tsx .",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 we should probably add .ts as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to add this in separate PR, it seems there is a need to add some additional packages in order for lint to work properly with .ts files. Don't want to make a mess here

src/api/index.ts Outdated
import { getApiUri } from '../misc/url'
import { Snippet, RawSnippet } from '../store'

export const fetchSnippet = (id: number) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can add a return type to these helpers

src/api/index.ts Outdated
body: JSON.stringify(snippet),
})
.then(response => response.json())
.then((json) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but there is no need to create an anonymous function .then(onSuccess) should work

name: modesByName[item].caption,
value: item,
}))
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, a blank line is missing

@lotrien lotrien force-pushed the recoil branch 2 times, most recently from df71db7 to fbeb565 Compare January 19, 2021 23:41
@lotrien lotrien marked this pull request as ready for review January 19, 2021 23:43
@lotrien
Copy link
Member Author

lotrien commented Jan 19, 2021

hey guys @Snizhana @ikalnytskyi I would highly appreciate some 👀 on recoil usage

@lotrien lotrien force-pushed the recoil branch 2 times, most recently from 0ac6b8b to a447993 Compare January 20, 2021 15:14
Copy link
Member

@ikalnytskyi ikalnytskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what Recoil is, but looks better now! 💪

@lotrien lotrien merged commit 6aa1ef0 into master Jan 22, 2021
@lotrien lotrien deleted the recoil branch January 22, 2021 18:37
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.

4 participants