All notable changes to this project will be documented in this file.
Minor update, removed a helper method search_path_to_camelized_param
that was no longer needed and fixed the existing param_to_search_path
to skip over number as props_template will also do that.
Essentially reverts the backward breaking change for the removal of virtual_path_of_template. A method called active_template_virtual_path was introduced in props_template 0.32. Using controller_path and action_name identifier was causing issues with associating a template with a component.
Backward breaking changes. Superglue now uses props_template 0.31.0 which removes the use of virtual_path_of_template in favor of a simplier controller_path and action_name identifier. See https://github.com/thoughtbot/props_template/blob/main/NEWS.md#0310-dec-6-2023 for a migration path.
Backward breaking changes! Superglue now uses props_template 0.30.0 which no longer autocamelize keys. See https://github.com/thoughtbot/props_template/blob/main/NEWS.md#0300-nov-25-2023 for details and a migration path.
Updates generators to use redux starter kit. Superglue will also generate
a few handy slices for use. Generators will also use a new Rails helper
form_props to make building
forms as easy as form_with
Move flash to a slice. This is a backward breaking change, to transition see this PR for details on how to transition to a slice.
Readme updated and non-working links fixed.
Scroll history and cache restore strategies (fromCacheOnly
, revisitOnly
,
fromCacheAndRevisitInBackground
default) added.
history
npm package upgraded.
Project renamed to superglue
Added back the props_from_form_with
helper and update to use latest
html-dom-parser.
Breezy can now be rendered on SSR using humid.
Remove helpers and methods no longer needed.
props_from_form_with
- Let the browser handle xdomain reqs.
Renamed master
to main
Added more fined grained control over deferments by allowing to specify custom success and fail action creators:
json.inner(defer: [:auto, success_action: 'SUCCESS', fail_action: 'FAIL']) do
json.greeting do
json.foo 'hello world'
end
end
Fragment auto update is removed as the feature seemed too brittle to use. Instead I'm encouraging users do this by themselves on the front using standard redux reducers. The fragment functionality has been changed to as a way to optionally tag your nodes with information about the partial being used, the path where the tag occured and the name you give to it. You can use this information to iterate across all your pages in your own reducer.:
fragments: [
{type: 'header', partial: 'header', path: 'data.a.b.c'}
],
Using the replace action in navigateTo to change the URL will now also replace the state in the same location in the store.
Remove reset_encoder! This strategy was not necessary and prevented props_template from being used in Puma.
Fix potential memory leak in OJ by dup'ing keys before push_key. This does make props_template a tiny bit slower.
visit and remote can now be customized to place code before and after the thunk gets called. These thunks are pre-wrapped with a dispatch and gets passed to the NavComponent which then gets passed to the page components as props.
The generator will also generate a new application.js and an application_visit.js file that includes entry points for this customization. This is a BREAKING CHANGE for the NavComponent.
Redux-Persist is now included as part of the generators. This solves an issue with modifications to the state that is not persisted when a user leave a breezy enabled page, and then loads the page from the disk cache later on only to see no changes. This is due to the initial state that gets loaded from the DOM.
Redux-Persist does add another layer to the stack, we add a simplified migration approach outlined in the commit.
Browser navigation with hashes are now supported. The change leans on browser defaults of jumping to the element. Interanally as long as the pathname and query match, breezy will treat them as the same pageKey.
application.js
refactored to a component. This enables better server side
rendering of HTML using react-rails
RailsTag
is now powered by html-react-parser
which includes server side
support.
Breezy.start
expects different and better named arguments, this is a BREAKING
CHANGE.
fetch
is now injected to Breezy. This enables server side rendering AND
ReactNative use cases. The latter used to be supported but was removed because of
resources
PropsTemplate now uses a single instance of Oj's StringWriter, be sure to update
your rails initializer to call Props.reset_encoder!
- Add UJS attributes data-bz-remote and data-bz-visit
- Add copyPage action to allow optimistic updates
- Allow visit thunks to use urls with bzq by allowing a placeholder option
- Ensure all requests made by breezy gets a __=0 cache buster retained through redirect
- Remove formik and use Rails forms
- Add RailsTag component to use Rails innerhtml without a container tag
- Updated generators
- Add props_from_form_with to generate props for forms from Rails
- Add redirect_back_with_bzq to redirect back while retaining the bzq param
- Breezy only supports rail 6 and on.
- BreezyTemplate is now replaced with PropsTemplate. Notable improvements over BreezyTemplate:
- Support for application layouts, e.g
application.json.props
- Mutli-fetch on
json.array!
render_collection
like behavior (single lookup for a partial) forjson.array!(partial: 'foobar)'
- Explicit control over node traversal via search options e.g
json.foobar(search:'foobar.posts.id=1')
- Renders
json
instead ofjs
- Support for application layouts, e.g
- BreezyJS no longer uses Server Generated Javascript Responses. It uses JSON and is now easier to use your favorite JSON browser plugin to see the JSON version of your page, for example:
localhost:3000/posts.json
- Breezy Rails controller requirements is simplified, no macros needed just plain Rails, be sure to
rails generate scaffold post
orrails breezy:install:web
to see what changed.
- Update tests for rails 6
- Remove support for rails 4
- Update gemspec, removed some unneeded dependancies
- Use JSON.dump instead of MultiJSON
- Remove dead comments and methods
- Drop pessimistic version constraint
BREAKING CHANGE: partial rendering was passed existing context prefixes when it wasn't supposed to, this broke some parts of caching, and generated the wrong fragment cache key.
Fix: When using node filtering eg. _bz=foo.bar.my_node
, caching on the targest ancestors is disabled.
Fix: Inline partials were not caching properly, it ran and saved the partial in the cache every time.
BREAKING CHANGE: Rename _bz
param to bzq
- BREAKING CHANGE:
withBrowserBehavior
has been renamed toenhanceVisitWithBrowserBehavior
and only accepts one arg, the visit action creator. - BREAKING CHANGE: All keys
json.my_key_here
in BreezyTemplate willkey_format
to camelCase{"myKeyHere": 'foobar'}
. This makes working with props received viamapStateToProps
easier to work with. - FIX:
remote
now merges joints on graft requests - BREAKING CHANGE:
remote
will update all joints before fetching nodes when using deferment. The previous behavior was to update after all deferred fetches were finished, but this caused some issues and confusion around proper behavior. This will be the fix for now. - NEW: Breezy now dispatches
@@breezy/GRAFTING_ERROR
. This is a listenable action that you can use to retry deferments that fail due to network errors. You will recieve thepageKey
, theurl
that failed, and thekeyPath
to the missing node. remote
now has a fallbackpageKey
if one isn't provided.ensureSingleVisit
, the function that powersvisit
is now exposed for use. Come in super handy when you want to create your ownvisit
function. For example, instaclick functionality.- BREAKING CHANGE: Remove immutable helpers. It doesn't seem like good practice to create immutable action creators, probably doing too much work for the user and makes testing more difficult. Instead recommend and document immmer usage and keep getIn (exported for traversing), and setIn (for internal use) around.
- BREAKING CHANGE:
remote
will update all joints before fetching nodes when using deferment. The previous behavior was to update after all deferred fetches were finished, but this caused some issues and confusion around proper behavior. This will be the fix for now. - BREAKING CHANGE:
visit
will strip all_bz
from url params. - BREAKING CHANGE: rename joints to fragments. Makes more sense conceptually.
- BREAKING CHANGE: remove
forEachPathToJointAcrossAllPages
and encourage the users to just iterate through each page and make the changes on their own. There are some attributes that are now moved toprivateOpts
, a key/value meant for internal use only. - FIX: Deferment wasn't working on multiple nested partials