Skip to content

Commit

Permalink
Remove template comments.
Browse files Browse the repository at this point in the history
These aren't too helpful and often clutters the generated components.  Instead
I've opted to update the docs/requests.md.
  • Loading branch information
jho406 committed Nov 30, 2024
1 parent c2b80b8 commit 8020ccc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
12 changes: 11 additions & 1 deletion docs/requests.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Requests

When you need more functionality than what UJS offers, Superglue comes with two
functions that wrap around fetch, `visit` and `remote`.
functions built around `fetch`, `visit` and `remote`. These are wrapped with
your own implementation in [application_visit.js] and can be accessed via the
NavigationContext.

```js
import { NavigationContext } from '@thoughtbot/superglue';

const { remote, visit } = useContext(NavigationContext)
```

[application_visit.js]: configuration.md#application_visitjs

## visit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
import { useSelector } from 'react-redux'
import { usePage } from '@thoughtbot/superglue'

export default function <%= js_plural_table_name(:upper) %>Edit ({
// visit,
// remote,
}) {
export default function <%= js_plural_table_name(:upper) %>Edit() {
const {
form,
<%= js_singular_table_name %>Path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import React from 'react'
import { Form, Layout } from '@javascript/components'
import { usePage } from '@thoughtbot/superglue'

export default function <%= js_plural_table_name(:upper) %>Index({
// visit,
// remote,
}) {
export default function <%= js_plural_table_name(:upper) %>Index() {
const {
new<%= js_singular_table_name(:upper) %>Path,
<%= js_plural_table_name %> = [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
import { useSelector } from 'react-redux'
import { usePage } from '@thoughtbot/superglue'

export default function <%= js_plural_table_name(:upper) %>New({
// visit,
// remote
}) {
export default function <%= js_plural_table_name(:upper) %>New() {
const {
form,
<%= js_plural_table_name %>Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import React from 'react'
import { Layout } from '@javascript/components'
import { usePage } from '@thoughtbot/superglue'

export default function <%= js_plural_table_name(:upper) %>Show({
// visit,
// remote,
}) {
export default function <%= js_plural_table_name(:upper) %>Show() {
const {
<%- attributes_list_with_timestamps.select{|attr| attr != :id }.each do |attr| -%>
<%=attr.camelize(:lower)%>,
Expand Down

0 comments on commit 8020ccc

Please sign in to comment.