Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

fix(core): make InstantSearch(Ssr) into regular .js files #605

Merged
merged 5 commits into from
Jan 17, 2019

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Jan 16, 2019

building further on #603

@Haroenv Haroenv requested a review from samouss January 16, 2019 17:06
The reason I did this is to make sure that rollup turns this into valid components (before the template was compiled into the arguments of `createInstantSearchComponent` instead of into its result.
@Haroenv Haroenv force-pushed the fix/instant-search-file branch from 68bc7ee to 51c088a Compare January 17, 2019 09:09
@Haroenv Haroenv requested review from a team and removed request for samouss January 17, 2019 09:09
@Haroenv Haroenv merged commit 3759d6f into feat/ssr-nuxt Jan 17, 2019
@Haroenv Haroenv deleted the fix/instant-search-file branch January 17, 2019 15:41
Haroenv added a commit that referenced this pull request Jan 17, 2019
* chore: initial nuxt setup

* refactor(SSR): hydrate doesn't assume where serialized state comes from

* feat(ssr): add a warning if __forceRender gets called without active helper

* docs(nuxt): add example

* docs(ssr): add styling

* chore(lint): fix minor errors

* chore(build): don't do examples of nuxt & ssr

* fix(warning): correct capitalisation

Co-Authored-By: Haroenv <fingebimus@me.com>

* fix(core): make InstantSearch(Ssr) into regular .js files (#605)

* fix(core): make InstantSearch(Ssr) into regular .js files

The reason I did this is to make sure that rollup turns this into valid components (before the template was compiled into the arguments of `createInstantSearchComponent` instead of into its result.

* chore(test): use a global mock of InstantSearch.js root

* chore: fix file lines

Co-Authored-By: Haroenv <fingebimus@me.com>
Co-Authored-By: Samuelv <users+samouss@github.com>

* fix(ssr): correct class name

* chore(test): cleaner snapshot

* chore(example): remove unused import

* refactor(ssr): better naming for function argument

* chore(test): update snapshot

* chore: remove wrong comment
Haroenv added a commit that referenced this pull request Jan 18, 2019
* chore: initial nuxt setup

* refactor(SSR): hydrate doesn't assume where serialized state comes from

* feat(ssr): add a warning if __forceRender gets called without active helper

* docs(nuxt): add example

* docs(ssr): add styling

* chore(lint): fix minor errors

* chore(build): don't do examples of nuxt & ssr

* fix(warning): correct capitalisation

Co-Authored-By: Haroenv <fingebimus@me.com>

* fix(core): make InstantSearch(Ssr) into regular .js files (#605)

* fix(core): make InstantSearch(Ssr) into regular .js files

The reason I did this is to make sure that rollup turns this into valid components (before the template was compiled into the arguments of `createInstantSearchComponent` instead of into its result.

* chore(test): use a global mock of InstantSearch.js root

* chore: fix file lines

Co-Authored-By: Haroenv <fingebimus@me.com>
Co-Authored-By: Samuelv <users+samouss@github.com>

* fix(ssr): correct class name

* chore(test): cleaner snapshot

* chore(example): remove unused import

* refactor(ssr): better naming for function argument

* chore(test): update snapshot

* chore: remove wrong comment
Haroenv added a commit that referenced this pull request Jan 23, 2019
* chore: update lockfile

* chore: add initial ssr example (no Algolia)

* chore: redo SSR via vue cli & add algolia page

* temp commit

* chore(lint): allow $_ais

* feat(ssr): split up components

* refactor(ssr): factorise example usage

* fix: call render once on client to give state before render

* chore: remove log

* chore: set default params to avoid highlight not working

* chore: fix tests

* chore: no linting on ssr example until we are done

* fix: make sure it works with complex components

search parameters is necessary if during mount the widget uses functions on the results

* chore: rename ais-ssr to ais-instant-search-ssr

* docs: refinement-list in example

* fix: correct name for ais-instant-search-ssr

* feat: throw warning when SSR and no injection

* test(ssr): initial component

* feat: rename all SSR methods

* chore(ssr): small logic refactor of name

Co-Authored-By: Haroenv <fingebimus@me.com>

* chore: make linting pass

* refactor(ssr): rename internal file

* chore: remove helper-serializer

* chore(build): allow spread

* chore(example): kebab

* feat(ssr): move monkeypatching inside code

* docs(example): pagination

* test(ssr): write tests for all injection functions

* chore: downgrade node

* chore(babel): allow spread in storybook

* docs(ssr): add Nuxt example (#603)

* chore: initial nuxt setup

* refactor(SSR): hydrate doesn't assume where serialized state comes from

* feat(ssr): add a warning if __forceRender gets called without active helper

* docs(nuxt): add example

* docs(ssr): add styling

* chore(lint): fix minor errors

* chore(build): don't do examples of nuxt & ssr

* fix(warning): correct capitalisation

Co-Authored-By: Haroenv <fingebimus@me.com>

* fix(core): make InstantSearch(Ssr) into regular .js files (#605)

* fix(core): make InstantSearch(Ssr) into regular .js files

The reason I did this is to make sure that rollup turns this into valid components (before the template was compiled into the arguments of `createInstantSearchComponent` instead of into its result.

* chore(test): use a global mock of InstantSearch.js root

* chore: fix file lines

Co-Authored-By: Haroenv <fingebimus@me.com>
Co-Authored-By: Samuelv <users+samouss@github.com>

* fix(ssr): correct class name

* chore(test): cleaner snapshot

* chore(example): remove unused import

* refactor(ssr): better naming for function argument

* chore(test): update snapshot

* chore: remove wrong comment

* fix(test): avoid broken dependency injection

* refactor(ssr): remove findRoot

* refactor(ssr): findResultsState returns nothing, introduce getState

* docs(example): update code

* chore(examples): remove unused sample files

* docs(example-ssr): make use of correct state var

* fix(ssr): move getState error to warning

this is not a fatal warning, so throwing can confuse people

* chore(example): lint

* fix(ssr): prevent overriding of forced parameters

* chore(ssr): improve test wording

* docs(ssr): add explaining comment on searchOnce

* fix(babel): use _objectSpread from babel instead of Object.assign

* refactor(ais-instant-search): move from pure factory function to augmented factory

This limits the amounts of conditionals in the code

* chore(rollup): remove spread

* chore(babel): remove spread

* chore(nuxt): simpler example

* chore(examples): avoid lint for now (prettier conflicts)

* chore(nuxt): easier example

* chore(ssr-example): only hydrate if possible

* fix(ssr): only __forceRender once on server, once on client

*  fix(core): prevent instance from starting multiple times (#607)

* fix(core): prevent instance from starting multiple times

This was no problem with regular InstantSearch; but when in SSR the instance is not recreated when InstantSearch mounts; and thus it starts again, which throws an error.

We need to set the flag to false, since otherwise InstantSearch throws an error.

* chore: add maintainer note

* chore(test): general improvements

* test(core): dispose gets called and started gets patched

* chore(build): fix indention

* refactor(ssr): getState shouldn't warn if early

* test(mock): remove global _stalledSearchDelay

* chore(example): add vue-instantsearch via npm

* chore(nuxt): consistent state naming

* test(cis): better naming

* refactor(CISC): move spreading into util

* refactor(cis): createInstantSearch has same signature as regular instantsearch

* fix(destroy): set helper to null to avoid old requests

see algolia/instantsearch#3415

* chore: remove unused import

* fix(ssr): review of error messages

Co-Authored-By: Haroenv <fingebimus@me.com>

fix(core): better errors

* chore(errors): fix typo

* chore(lint): prettier

* chore(jest): fix static mock

* fix(core): set hydrated to false on destroy

* fix(ssr): do not allow instance to start multiple times

This can only happen in extreme edge cases (mount - unmount - nextTick - mount).
@Haroenv Haroenv mentioned this pull request Jan 23, 2019
Closed
Haroenv added a commit to algolia/instantsearch that referenced this pull request Dec 28, 2022
* chore: update lockfile

* chore: add initial ssr example (no Algolia)

* chore: redo SSR via vue cli & add algolia page

* temp commit

* chore(lint): allow $_ais

* feat(ssr): split up components

* refactor(ssr): factorise example usage

* fix: call render once on client to give state before render

* chore: remove log

* chore: set default params to avoid highlight not working

* chore: fix tests

* chore: no linting on ssr example until we are done

* fix: make sure it works with complex components

search parameters is necessary if during mount the widget uses functions on the results

* chore: rename ais-ssr to ais-instant-search-ssr

* docs: refinement-list in example

* fix: correct name for ais-instant-search-ssr

* feat: throw warning when SSR and no injection

* test(ssr): initial component

* feat: rename all SSR methods

* chore(ssr): small logic refactor of name

Co-Authored-By: Haroenv <fingebimus@me.com>

* chore: make linting pass

* refactor(ssr): rename internal file

* chore: remove helper-serializer

* chore(build): allow spread

* chore(example): kebab

* feat(ssr): move monkeypatching inside code

* docs(example): pagination

* test(ssr): write tests for all injection functions

* chore: downgrade node

* chore(babel): allow spread in storybook

* docs(ssr): add Nuxt example (algolia/vue-instantsearch#603)

* chore: initial nuxt setup

* refactor(SSR): hydrate doesn't assume where serialized state comes from

* feat(ssr): add a warning if __forceRender gets called without active helper

* docs(nuxt): add example

* docs(ssr): add styling

* chore(lint): fix minor errors

* chore(build): don't do examples of nuxt & ssr

* fix(warning): correct capitalisation

Co-Authored-By: Haroenv <fingebimus@me.com>

* fix(core): make InstantSearch(Ssr) into regular .js files (algolia/vue-instantsearch#605)

* fix(core): make InstantSearch(Ssr) into regular .js files

The reason I did this is to make sure that rollup turns this into valid components (before the template was compiled into the arguments of `createInstantSearchComponent` instead of into its result.

* chore(test): use a global mock of InstantSearch.js root

* chore: fix file lines

Co-Authored-By: Haroenv <fingebimus@me.com>
Co-Authored-By: Samuelv <users+samouss@github.com>

* fix(ssr): correct class name

* chore(test): cleaner snapshot

* chore(example): remove unused import

* refactor(ssr): better naming for function argument

* chore(test): update snapshot

* chore: remove wrong comment

* fix(test): avoid broken dependency injection

* refactor(ssr): remove findRoot

* refactor(ssr): findResultsState returns nothing, introduce getState

* docs(example): update code

* chore(examples): remove unused sample files

* docs(example-ssr): make use of correct state var

* fix(ssr): move getState error to warning

this is not a fatal warning, so throwing can confuse people

* chore(example): lint

* fix(ssr): prevent overriding of forced parameters

* chore(ssr): improve test wording

* docs(ssr): add explaining comment on searchOnce

* fix(babel): use _objectSpread from babel instead of Object.assign

* refactor(ais-instant-search): move from pure factory function to augmented factory

This limits the amounts of conditionals in the code

* chore(rollup): remove spread

* chore(babel): remove spread

* chore(nuxt): simpler example

* chore(examples): avoid lint for now (prettier conflicts)

* chore(nuxt): easier example

* chore(ssr-example): only hydrate if possible

* fix(ssr): only __forceRender once on server, once on client

*  fix(core): prevent instance from starting multiple times (algolia/vue-instantsearch#607)

* fix(core): prevent instance from starting multiple times

This was no problem with regular InstantSearch; but when in SSR the instance is not recreated when InstantSearch mounts; and thus it starts again, which throws an error.

We need to set the flag to false, since otherwise InstantSearch throws an error.

* chore: add maintainer note

* chore(test): general improvements

* test(core): dispose gets called and started gets patched

* chore(build): fix indention

* refactor(ssr): getState shouldn't warn if early

* test(mock): remove global _stalledSearchDelay

* chore(example): add vue-instantsearch via npm

* chore(nuxt): consistent state naming

* test(cis): better naming

* refactor(CISC): move spreading into util

* refactor(cis): createInstantSearch has same signature as regular instantsearch

* fix(destroy): set helper to null to avoid old requests

see algolia/instantsearch.jsalgolia/vue-instantsearchalgolia/vue-instantsearch#3415

* chore: remove unused import

* fix(ssr): review of error messages

Co-Authored-By: Haroenv <fingebimus@me.com>

fix(core): better errors

* chore(errors): fix typo

* chore(lint): prettier

* chore(jest): fix static mock

* fix(core): set hydrated to false on destroy

* fix(ssr): do not allow instance to start multiple times

This can only happen in extreme edge cases (mount - unmount - nextTick - mount).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants